I have a repeater and inside it a linkbutton, the repeater is bound to OnItemCommand but the event is not firing here is my code:
<asp:Repeater ID="rptList" runat="server" OnItemDataBound="rpt_OnItemDataBound" OnItemCommand="rptList_ItemCommand">
<ItemTemplate>
<asp:LinkButton ID="lbName" Text='<%# Eval("Name") %>' runat="server"
CommandArgument='<%# Eval("ID").ToString() %>' CommandName="NameClick">
</asp:LinkButton><br />
<asp:Label ID="lblCreateDate" runat="server" Text='<%# Eval("CreateDate") %>' /><br />
<br />
</ItemTemplate>
</asp:Repeater>
here is the code behind:
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
switch (e.CommandName)
{
case "NameClick":
Guid id = (Guid)e.CommandArgument;
//do something
break;
default:
break;
}
}