Buttons inside a Repeater
I have a Linkbutton control inside the template for a Repeater control.
So far, all i have been able to find out is that you can get the text of the linkbutton through the repeaters ItemCommand method, but all my link buttons have the same text.
Does anyone have any strategies for putting buttons inside a repeater or datalist?
Re: Buttons inside a Repeater
Yeah, well, I see no problem in that. But I suppose, that the ID's (not caption) are not all the same (in which case you ought to change your code)
I use this in the repeater_ItemCommand()
Code:
System.Web.UI.Control c = ((System.Web.UI.Control)(((System.Web.UI.WebControls.WebControl)(((System.Web.UI.WebControls.LinkButton)(((System.Object)(e.CommandSource))))))));
switch (c.ID)
{
case "LinkBtn_Abonnent":
arr1.Sort(new abon_data.Comparer_SAPComp(SAPDefines.SAP_ORDERBY_ABONNENT));
break;
That won't mind the caption being the same on all link buttons :-)
/Lars
Re: Buttons inside a Repeater
Actually you want to utilize the COMMANDNAME property of the LinkButtons to differentiate between them.