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

Hide edit column

1 Answer 19 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tina
Top achievements
Rank 1
Tina asked on 25 May 2012, 09:16 AM
I am trying to hide the edit column fro a bound column with user id=25 using getcolumn() method in prerender.But it hides the column for all users.How to hide the column for single user?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 May 2012, 10:51 AM
Hi Tina,

Try the following code snippet to hide the Edit column.

C#:
protected void rdgrd_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
   if (e.Item is GridDataItem)
   {
      GridDataItem itm = (GridDataItem)e.Item;
      TableCell cell = itm["ProductName"];
      if(cell.Text=="1")
      {
         LinkButton lnk=(LinkButton)itm["AutoGeneratedEditColumn"].Controls[0];  //if you are using for auto generated edit column
         lnk.Visible=false;
         LinkButton lnk1 = (LinkButton)itm["Edit"].Controls[0];  // if you are using GridEditCommandColumn
         lnk1.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