title: Dynamically Generated Telerik MVC3 Grid - Add Checkboxes
body: <p>I have a grid that is dynamically generated based on search criteria. I render the grid in a partial view using Ajax. That all works fine.</p>
  
  <p>I now need to add a checkbox column as the first column.</p>
  
  <p>Also, how do I get filtering, sorting paging etc. to work now since it is in a partial view.
  When i click on a header to sort I get a Page not found error and the filter Icon doesnt do anything.</p>
  
  <p>And one more thing. When I try to add a GridCommandColumnSettings to the grid I get the error
  "Invalid initializer member declarator"</p>
  
  <p>Code is below for the gridcolumnsettings</p>
  
  <pre><code>    public GridColumnSettings[] NewColumns(DataTable fullDT)
      {
          GridColumnSettings[] newColumns = new GridColumnSettings[fullDT.Columns.Count];
  
          for (int i = 0; i &lt; fullDT.Columns.Count; i++)
          {
              // set the visibility property for the DeliveryID
              bool boolDeliveryID;
              if (fullDT.Columns[i].ColumnName == "DeliveryID")
                  boolDeliveryID = false;
              else
                  boolDeliveryID = true;
  
              newColumns[i] = new GridColumnSettings
              {
                  new GridCommandColumnSettings
                  {
                      Commands = 
                      {
                          new GridEditActionCommand(),
                          new GridDeleteActionCommand()
                      },
                      Width = "200px",
                      Title = "Commands"
                  },
                  Member = fullDT.Columns[i].ColumnName,
                  Title = fullDT.Columns[i].ColumnName,
                  Visible = boolDeliveryID,
                  Filterable = true,
                  Sortable = true
              };
          }
          return newColumns;
      }
  </code></pre>
  
  <p>Any suggestions would be appreciated.</p>
  
  <p>Thanks</p>
  
  <p>I edited my post to add my partial for the Grid</p>
  
  <pre><code>Here is my partial for the grid
  
  @(Html.Telerik().Grid&lt;System.Data.DataRow&gt;(Model.Data.Rows.Cast&lt;System.Data.DataRow&gt;())
  .Name("Grid")
  .Columns(columns =&gt;
  {
      columns.LoadSettings(Model.Columns as IEnumerable&lt;GridColumnSettings&gt;);
  })
  .DataBinding(dataBinding =&gt;       dataBinding.Ajax().Select("_DeliveryManagerCustomBinding", "Deliveries"))
  .EnableCustomBinding(true)
   .Resizable(resize =&gt; resize.Columns(true))
  </code></pre>
  
  <p>)</p>