Disable grid column

2 posts, 0 answers
  1. Anzar
    Anzar avatar
    62 posts
    Member since:
    Sep 2012

    Posted 20 Sep 2012 Link to this post

    Hi,
    I have to disable some columns in telrik rad grid or set the column as read only.

    Thanks & Regards
    Anzar.M
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Sep 2012 Link to this post

    Hi,

    You can set the column's ReadOnly property as true to make it disabled in edit mode.
    aspx:
    <telerik:GridBoundColumn DataField="EmployeeID" ReadOnly="true" UniqueName="EmployeeID" HeaderText="EmployeeID">
    </telerik:GridBoundColumn>
    C#:
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
     if (e.Item is GridEditableItem && e.Item.IsInEditMode)
     {
        GridEditableItem item = (GridEditableItem)e.Item;
        TextBox txt = (TextBox)item["EmployeeID"].Controls[0];
        txt.ReadOnly = true;
     }
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top