title: jqGrid need a field editable on Add dialog but not Edit dialog
body: <p>I'm attempting to use jqGrid in my ASP.Net MVC application and have a requirement that some columns arre editable in the Add dialog but not the Edit dialog. Apparently the way to do this is to use the beforeShowForm javascript event and set the properties on the particular input field.</p>
  
  <p>So far I can't manage to get the beforeShowForm event to fire. Below is an example I found on another <a href="https://stackoverflow.com/questions/1987881/how-to-have-different-edit-options-for-add-edit-forms-in-jqgrid">SO question</a> but so far I haven't managed to get it working. Is there some trick I'm missing? I'm using the latest 3.8 version of jqGrid.</p>
  
  <p>Controller:</p>
  
  <pre><code> [Authorize]
   public ActionResult Index()
   {
        var gridModel = new MyGridModel();
        SetUpGrid(gridModel.MyGrid);
        return View(gridModel);
   }
  
   private void SetUpGrid(JQGrid grid)
   {
          grid.DataUrl = Url.Action("GridDataRequested");
          grid.EditUrl = Url.Action("EditRows");
          grid.ToolBarSettings.ShowSearchToolBar = false;
  
          grid.ToolBarSettings.ShowEditButton = true;
          grid.ToolBarSettings.ShowAddButton = true;
          grid.ToolBarSettings.ShowDeleteButton = true;
          grid.ToolBarSettings.ShowRefreshButton = true;
          grid.EditDialogSettings.CloseAfterEditing = true;
          grid.AddDialogSettings.CloseAfterAdding = true;
  
          grid.EditDialogSettings.Modal = false;
          grid.EditDialogSettings.Width = 500;
          grid.EditDialogSettings.Height = 300;
  
          grid.ClientSideEvents.GridInitialized = "initGrid";
   }
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>public class MyGridModel
  {
      public JQGrid MyGrid { get; set; }
  
      public MyGridModel()
      {
        MyGrid = new JQGrid
        {
          Columns = new List&lt;JQGridColumn&gt;()
          {
              new JQGridColumn { DataField = "id", 
                                 PrimaryKey = true,
                                 Visible = false,
                                 Editable = false },
              new JQGridColumn { DataField = "username", 
                                 Editable = true,
                                 EditFieldAttributes = new List&lt;JQGridEditFieldAttribute&gt;()
                                 {
                                       new JQGridEditFieldAttribute(){ Name = "readonly", Value = "true"},
                                       new JQGridEditFieldAttribute(){ Name = "disabled", Value = "true"}
                                  },
                                  Width = 100},
              new JQGridColumn { DataField = "domain", 
                                 Editable = true,
                                 EditFieldAttributes = new List&lt;JQGridEditFieldAttribute&gt;()
                                 {
                                      new JQGridEditFieldAttribute(){ Name = "readonly", Value = "true"},
                                      new JQGridEditFieldAttribute(){ Name = "disabled", Value = "true"}
                                  },
                                  Width = 100}
                }
            }
       }
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>function initGrid() {
  
    jQuery("#myGrid").jqGrid('navGrid','#myGrid-pager',
              { }, //options
              { // edit options
                  beforeShowForm: function(frm) {
                      alert("beforeShowForm edit");
                  }
              },
              { // add options
                  beforeShowForm: function(frm) {
                      alert("beforeShowForm add");
                  }
              },
              { }, // del options
              { } // search options
          );
  }
  
  &lt;div&gt;           
      &lt;%= Html.Trirand().JQGrid(Model.MyGrid, "myGrid") %&gt;
  &lt;/div&gt;
  </code></pre>