DEVMBM DEVMBM - 1 month ago 16
ASP.NET (C#) Question

How to find control in CommandItemTemplate for RadGrid

I'm using RadGrid from Telerik with three LinkButton controls in CommandItem , and i want to hide or show them using switch statement at code behind.

<LinkButton runat="server" ID="approveAllLink" Text="Approve All" >
<LinkButton runat="server" ID="approveLink" Text="Approve" >
<LinkButton runat="server" ID="rejectLink" Text="Reject" >

Is there anyway solve this case?


What about this?

GridItem cmdItem = RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)[0]; 
LinkButton approveAllLink = cmdItem.FindControl("approveAllLink") as LinkButton; 
LinkButton approveLink = cmdItem.FindControl("approveLink") as LinkButton; 
LinkButton rejectLink= cmdItem.FindControl("rejectLink") as LinkButton; 

// Your switch logic here