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

Disable grid column

1 Answer 451 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anzar
Top achievements
Rank 2
Anzar asked on 20 Sep 2012, 06:18 AM
Hi,
I have to disable some columns in telrik rad grid or set the column as read only.

Thanks & Regards
Anzar.M

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Sep 2012, 06:32 AM
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.
Tags
Grid
Asked by
Anzar
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Share this question
or