This is a migrated thread and some comments may be shown as answers.

Hide edit column based on condition

1 Answer 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 13 Apr 2012, 01:07 PM
Here is the code that I am trying. How to hide autogenerated edit column based on cell text?
protected void StoresGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            TableCell cell = (TableCell)item["StoreId"];
           if(cell.Text=="1")
      //how to hide autogenerated edit column here
              
}
}

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 Apr 2012, 01:57 PM
Hi Tina,

Try the following code to hide AutoGenerateEditColumn based on text in the cell.

C#:
if (cell.Text == "1")
   {
       LinkButton btn = (LinkButton)item["AutoGeneratedEditColumn"].Controls[0];
       btn.Visible = false;
   }

Thanks,
Princy.
Tags
General Discussions
Asked by
Tina
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or