Usercontrol with Repeater not firing the repeater's ItemCommand event
I am using SF 4.4, upgraded from 4.3 and utilizing a custom usercontrol (.ascx) as a widget template to display a document list with some logic behind it. The custom template works perfect except nothing I do per all the other posts I've seen around the web on this issue seems to get the repeater's ItemCommand event to fire. Viewstate IS enabled for the page this user control is in and I have set the "OnItemCommand" for the repeater. I do not have anything else happening in the codebehind at this point and have stripped it all out trying to get this to work. Thoughts??
Below is my code.
Protected Sub documentsRepeater_ItemCommand(source As Object, e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles documentsRepeater.ItemCommand
End Sub
<%@ Control Language="VB" AutoEventWireup="true" CodeFile="OpenAccessDataProvider,57D8E0F28B3D4CBF96A4000000000001.ascx.vb"
Inherits="SfCtrlPresentation_OpenAccessDataProvider_57D8E0F28B3D4CBF96A4000000000001"
EnableViewState="True" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit"
Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<
sitefinity:ResourceLinks
ID
=
"resourcesLinks2"
runat
=
"server"
UseEmbeddedThemes
=
"true"
Theme
=
"Default"
>
<
sitefinity:ResourceFile
Name
=
"Telerik.Sitefinity.Resources.Themes.Basic.Styles.icons.css"
Static
=
"true"
/>
</
sitefinity:ResourceLinks
>
<
sf:BrowseAndEditToolbar
ID
=
"browseAndEditToolbar"
runat
=
"server"
Mode
=
"Edit"
>
</
sf:BrowseAndEditToolbar
>
<
div
id
=
"itemsContainer"
class
=
"articles"
runat
=
"server"
>
<
asp:Repeater
ID
=
"documentsRepeater"
runat
=
"server"
OnItemCommand
=
"documentsRepeater_ItemCommand"
>
<
HeaderTemplate
>
<
ul
class
=
"articles sfListMode"
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
li
id
=
"docItem"
runat
=
"server"
class
=
"article separator sfdownloadFile"
>
<
h3
>
<%# Eval("Title")%></
h3
>
<%# Eval("Description") %><
br
/>
<
asp:Button
runat
=
"server"
ID
=
"btnDownload"
Text
=
"Download"
CausesValidation
=
"False"
CommandName
=
"requestResource"
CommandArgument='<%# Eval("Id") %>'></
asp:Button
>
</
li
>
</
ItemTemplate
>
<
FooterTemplate
>
</
ul
>
</
FooterTemplate
>
</
asp:Repeater
>
</
div
>
<
sitefinity:Pager
ID
=
"pager"
runat
=
"server"
>
</
sitefinity:Pager
>
Hello Craig,
Thank you for using our services. We have tried using the provided control on several local Sitefinity projects, and had no problems hitting the breakpoint in ItemCommand event of the repeater. Can you please check if the problem reproduces in a clear Sitefinity page, and if it doesn't are there any specific controls on the current page that might interfere with the repeater's functionality?
If any problems persist, can you please try substituting the Repeater control with our RadListView, which should serve equivalent functionality, and let us know if the problem reproduces with it as well? Thanks in advance for your kind cooperation,
Hi Boyan,
Hi,
If you're not referencing the control inside an event handler but rather in a class you can use GetControl<T> for example:
protected
internal
virtual
RadListView DocumentsList
get
return
this
.Container.GetControl<RadListView>(
"DocumentsList"
,
true
);
var quantityControl = e.Item.FindControl(
"QuantityBox"
)
as
TextBox;