Set Column to readonly when in edit mode

Posted by Community Admin on 03-Aug-2018 18:06

Set Column to readonly when in edit mode

All Replies

Posted by Community Admin on 11-Oct-2011 00:00

I am using 'GridTemplateColumns' on my radgrid and I have trouble setting one of my columns to 'readonly' ONLY when its in 'edit mode'.  Does anyone have any suggestions in how to do this programmatically...?

Posted by Community Admin on 14-Oct-2011 00:00

Hi Aret,

Try the following approach:

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
  
  
    if (e.Item.IsInEditMode && !(e.Item is IGridInsertItem))
  
        (e.Item as GridEditableItem)["ColumnName"].Enabled = false;
  


I hope this helps.

Best wishes,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

This thread is closed