How To Hide – Show Image Button in Telerik Rad Grid

In order to set the visibility for the control , you need to access the control first and then set the visibility. Here is a sample code. In C#

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
if (Item.FindControl("UniqueName") as Textbox (your control's Unique Name))// Add your condition
{
item ["UniqueName"].Visible=false; // setting visibility of the GridBoundColumn
}
}
}

On the Aspx Page

<telerik:GridBoundColumn DataField="StatusCode" HeaderText="StatusCode" UniqueName="StatusCode">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn UniqueName="BtnCol" HeaderText="ButtonCol" Text="Accept">
</telerik:GridButtonColumn>

Leave a Reply