Set Column to readonly when in edit mode - General Discussions - General Discussions - Progress Community
 General Discussions

Set Column to readonly when in edit mode

  • Set Column to readonly when in edit mode
  • 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...?
  • 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