Click to See Complete Forum and Search --> : Buttons inside a Repeater


SigEpUCI
November 5th, 2002, 09:09 PM
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?

mhuguet
November 11th, 2002, 07:43 AM
You're question is a little broad. Can you be more specific?

Lars_V_J
May 10th, 2005, 02:39 AM
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()


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

coolbiz
May 10th, 2005, 09:47 PM
Actually you want to utilize the COMMANDNAME property of the LinkButtons to differentiate between them.