Hide edit column

2 posts, 0 answers
  1. Tina
    Tina avatar
    130 posts
    Member since:
    Jul 2011

    Posted 25 May 2012 Link to this post

    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?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 May 2012 Link to this post

    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.
Back to Top