@{
    ViewBag.Title = "Home Page";
}
@using GridPopupEditing.Models

       @(Html.Kendo().Grid<OrderViewModel>()
          .Name("grid")
          .ToolBar(t=>t.Create())
          .Columns(columns =>
          {
              columns.Bound(p => p.OrderID).Filterable(false);
              columns.Bound(p => p.ShipCountry);
              columns.Bound(p => p.CarMake).ClientTemplate("#= CarMake ? CarMake.Name: ''  #");
              columns.Bound(p => p.CarModel).ClientTemplate("#= CarModel ? CarModel.Name: '' #");
              columns.Command(c => c.Edit());
          })
          .Pageable()
          .Sortable()
          .Scrollable()
          .Editable(e => e.Mode(GridEditMode.InLine))
          .HtmlAttributes(new { style = "height:550px;" })
          .DataSource(dataSource => dataSource
             .Ajax()
             .Model(m =>
             {
                 m.Id("OrderID");
                 m.Field(f => f.OrderID).Editable(false);
                 m.Field(f => f.CarMake).DefaultValue(new CarMake() { Name = "Tesla", Id = 1 });
                 m.Field(f => f.CarModel).DefaultValue(new CarModel() { Name = "ROADSTER", Id = 1 });
             })
           .PageSize(20)
           .Read(read => read.Action("Orders_Read", "Grid"))
           .Create(create => create.Action("Orders_Create", "Grid"))
           .Update(update => update.Action("Orders_Update", "Grid"))
        )
       )
