title: Set ReadOnly property to a column of devexpress grid(MVC) only on edit click
body: <p>I have a devexpress grid in my partial view,</p>
  
  <p>Each row of the grid has an add, update and delete button. </p>
  
  <p>When clicked on update of the particular row, a form pops down which contains all the columns of the grid.</p>
  
  <p>Now i want to set the readonly property of one of the columns to true, which i did by <code>column.ReadOnly = true;</code></p>
  
  <p>But what this does is sets the column to readonly always i.e. even during New Click.</p>
  
  <p>Where as i want this readonly property only during edit click. </p>
  
  <p>here is my devexpress grid code</p>
  
  <pre><code>@{
  
      var grid = Html.DevExpress().GridView(settings =&gt;
      {
          settings.Name = "GridViewDuration";
          settings.CallbackRouteValues = new { Controller = "DurationMaster", Action = "GridViewDurationPartial" };
  
          settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "MyController", Action = "MyControllerAction1" };
          settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "MyController", Action = "MyControllerAction2" };
          settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "MyController", Action = "MyControllerAction3" };
          settings.SettingsEditing.Mode = GridViewEditingMode.EditFormAndDisplayRow;
          settings.SettingsBehavior.ConfirmDelete = true;
  
          settings.CommandColumn.Visible = true;
          settings.CommandColumn.ShowNewButton = true;
          settings.CommandColumn.ShowDeleteButton = true;
          settings.CommandColumn.ShowEditButton = true;
  
          settings.KeyFieldName = "DurationId";
  
          settings.SettingsPager.Visible = true;
          settings.SettingsPager.PageSize = 20;
          settings.Settings.ShowGroupPanel = true;
          settings.Settings.ShowFilterRow = true;
          settings.SettingsBehavior.AllowSelectByRowClick = false;
          settings.Columns.Add(column =&gt;
          {
              column.FieldName = "Column1";
              column.ReadOnly = true;
              column.Width = 20;
  
          });
          settings.Columns.Add(column =&gt;
          {
              column.FieldName = "Column2";
              column.Caption = "xyz";
              column.ColumnType = MVCxGridViewColumnType.ComboBox;
              column.Width = 250;
  
              var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties;
              comboBoxProperties.DataSource = PMC.Web.Controllers.DurationMasterController.getSelectList("0", "MyAction4");
              comboBoxProperties.TextField = "Text";
              comboBoxProperties.ValueField = "Value";
              comboBoxProperties.ValueType = typeof(int);
              comboBoxProperties.ValidationSettings.RequiredField.IsRequired = true;
  
  
          });
          settings.InitNewRow = (sender, e) =&gt;
          {
              e.NewValues["ColumnId"] = 0;
          };
          settings.Columns.Add("ColumnName");
          settings.Columns.Add("Description");
          //settings.Columns.Add("DisplayName");
          settings.Columns.Add(column =&gt;
      {
          column.Caption = "FromDate";
          column.FieldName = "FromDate";
          column.ColumnType = MVCxGridViewColumnType.DateEdit;
          column.ReadOnly = true;
          var DateEditProperties = column.PropertiesEdit as DateEditProperties;
          column.CellStyle.Wrap = DefaultBoolean.False;
      });
  
  
  
      settings.Columns.Add(column =&gt;
      {
          column.Caption = "ToDate";
          column.FieldName = "ToDate";
  
          column.ColumnType = MVCxGridViewColumnType.DateEdit;
          var DateEditProperties = column.PropertiesEdit as DateEditProperties;
          column.CellStyle.Wrap = DefaultBoolean.False;
      });
      });
      if (ViewData["EditError"] != null)
      {
          grid.SetEditErrorText((string)ViewData["EditError"]);
      }
  
  }
  @grid.Bind(Model).GetHtml()  
  </code></pre>
  
  <p>This is how my grid looks on initial load. 
  <a href="https://i.stack.imgur.com/rXexz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rXexz.png" alt="enter image description here"></a></p>
  
  <p>and when clicked on update for editing
  <a href="https://i.stack.imgur.com/tZZQS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tZZQS.png" alt="enter image description here"></a></p>