c# - How to get Repeater Item data object on ItemCommand event -
i have repeater of linkbuttons , on itemcommand event. need data object created link button.
my datasource list on itemcommand need myobject object = ???
are looking this? send id code behind using commandargument
can processed.
<asp:linkbutton id="linkbutton1" commandargument='<%# eval("id") %>' runat="server" commandname="mycommand">linkbutton</asp:linkbutton>
and in code behind:
protected void repeater1_itemcommand(object source, repeatercommandeventargs e) { if (e.commandname == "mycommand") { string myid = e.commandargument.tostring(); } }
or can use commandargument='<%# container.itemindex %>'
. know row number , can access corresponding index in source.
Comments
Post a Comment