Portal Engine
Version 3.x > Portal Engine > Link buttons don't fire ItemCommand in repeater control View modes: 
User avatar
Member
Member
yko - 11/7/2008 12:48:26 PM
   
Link buttons don't fire ItemCommand in repeater control
Hello,

I have a repeater in user control:
<asp:Repeater id="rpt1" runat="server" OnItemDataBound="rpt1_ItemDataBound" OnItemCommand="rpt1_ItemCommand">
<ItemTemplate>
...
<asp:linkbutton id="lnkAdd" CausesValidation="false" runat="server">Add</asp:linkbutton>
...
</ItemTemplate>
</asp:Repeater>

CommandName and CommandArgument properties of the link button are set in ItemDataBound event:
LinkButton lnkAdd = (LinkButton)e.Item.FindControl("lnkAdd");
lnkAdd.CommandName = "Add";
lnkAdd.CommandArgument = id.ToString();

Repeater's DataBind method is called in Page_PreRender:
protected void Page_PreRender(object sender, EventArgs e)
{
...
rpt1.DataSource = arr;
rpt1.DataBind();
...
}

But ItemCommand (rpt1_ItemCommand) event doesn't fire. Any ideas why?

Thanks

User avatar
Member
Member
yko - 11/10/2008 4:10:41 AM
   
RE:Link buttons don't fire ItemCommand in repeater control
I found a solution. It was related to ViewState.
See here http://devnet.kentico.com/Forums.aspx?ForumID=7&Thread=00003435