title: How to add columns in Kendo UI Grid Dynamically using DataSource's Generic List?
body: <p>This is the model I'm using:</p>
  
  <pre><code>public class DepartmentModel : TrackingModel
  {
      #region Properties
      public long PKDepartmentID { get; set; }        
  
      [StringLength(255, ErrorMessage = "*")]
      public string Code { get; set; }
  
      [StringLength(50, ErrorMessage = "*")]
      public string Location { get; set; }
  
      [StringLength(400, ErrorMessage = "Max 400 characters")]
      public string Description { get; set; }
  
  
      public string Country_Code { get; set; }
      public string State_Code { get; set; }
  
      public string ServiceCentreName { get; set; }
  
      public List&lt;FieldsModel&gt; DepartmentExt { get; set; }
  
      #endregion
  }
  
  public class FieldsModel
  {
      public string fieldName { get; set; }
      public string fieldValue { get; set; }
      public int dataType { get; set; }
  }
  </code></pre>
  
  <hr>
  
  <p>How can I add columns from p.DepartmentExt (List Of FieldsModel Class)?</p>
  
  <pre><code>              @(Html.Kendo().Grid&lt;Magellano.DAL.Models.DepartmentModel&gt;()
                  .Name("Grid")
                  .Columns(columns =&gt;
                  {
                      if (Html.HasDeleteRights())
                      {
                          columns.Bound(p =&gt; p.PKDepartmentID).Title("&lt;input id='chkDepartmentTop' type='checkbox' class='chkDepartmentTop'&gt;").ClientTemplate("#= multipledeleteLink(data) #").Filterable(false).Sortable(false).Width(3);
                      }
                      columns.Bound(p =&gt; p.Code).Title("Code");
                      columns.Bound(p =&gt; p.Description).Title("Description");
                      columns.Bound(p =&gt; p.Location).Title("Location").Filterable(false);
                      columns.Bound(p =&gt; p.Country_Code).Title("Country").Filterable(false);
                      columns.Bound(p =&gt; p.State_Code).Title("State").Filterable(false);
                      columns.Bound(p =&gt; p.IsPrimary).Title("Primary");                        
                      columns.Bound("test");
  
                      // How To Add Columns from p.DepartmentExt (List Of FieldsModel Class)
  
                      // ajax binding
                      if (Html.HasEditRights())
                      {
                          columns.Bound(p =&gt; p.PKDepartmentID).ClientTemplate("#= projectDetails(data) #").Title("").Filterable(false).Width(3);
                      }
                      if (Html.HasDeleteRights())
                      {
                          columns.Bound(p =&gt; p.PKDepartmentID).ClientTemplate("#= projectDelete(data) #").Title("").Filterable(false).Width(3);
                      }
  
                  })
                  .Pageable(pageable =&gt; pageable
                              .PageSizes(new[] { 10, 20, 30 })
                          )
  
                  .Sortable()
                  .TableHtmlAttributes(new { dbleditable = "true", canEdit = Html.HasEditRights().ToString().ToLower(), canDelete = Html.HasDeleteRights().ToString().ToLower() })
                  .Filterable()
                  .DataSource(dataSource =&gt; dataSource
                  .Ajax()
                  .PageSize(10)
                  .Model(model =&gt;
                                 {
                                     model.Field("test", typeof(string));
                                 })
  
                  .Read(read =&gt; read.Action("DepartmentList", "Department")))
              )
  </code></pre>