0

I am using RadGrid. How am I able to make whole column readonly or editable false.

Here I get the column

 protected void RadGrid1_PreRender(object sender, EventArgs e)
 {
   var colName = RadGrid1.MasterTableView.GetColumn(column.ColumnName);
 }

But there not property to set readonly true/false.

Is there any way I can set this column to editable false?

BenM
  • 4,218
  • 2
  • 31
  • 58
user1121267
  • 109
  • 3
  • 8

1 Answers1

0

Please try with the below code snippet.

1.

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    foreach (GridColumn column in RadGrid1.Columns)
    {
        if (column.UniqueName == "Name") //Your column uniqename
        {
            if (column.Owner.IsItemInserted)
            {
                ((GridBoundColumn)column).ReadOnly = false;
            }
            else
            {
                ((GridBoundColumn)column).ReadOnly = true;
            }
            break; // TODO: might not be correct. Was : Exit For
        }
    }

    RadGrid1.Rebind();
}

2. Telerik RadGrid set BoundColumn to ReadOnly in Edit Mode

Community
  • 1
  • 1
Jayesh Goyani
  • 11,008
  • 11
  • 30
  • 50