Post Grid Data not working

2 posts, 0 answers
  1. Antonio Avanic
    Antonio Avanic avatar
    4 posts
    Member since:
    Jul 2008

    Posted 17 Oct Link to this post

    Model binding is not working with post values from Kendo UI MCV Grid, I follow the MVC5 example about this topic, the grid shows the editable collection but when I post the values the view model collection is always null.

     

      @(Html.Kendo().Grid(Model.Profile.CollectionOption)
                                          .Name("colOptions")
                                          .Columns(columns =>
                                          {
                                              columns.Bound(p => p.Id).Hidden();
                                              columns.Bound(p => p.ModuleId).Hidden();
                                              columns.Bound(p => p.Module.Name).Title("Modulo");
                                              columns.Bound(p => p.Name).Title("Opcion");
                                              columns.Bound(p => p.Selected).Title("Seleccionar").ClientTemplate("<input type='checkbox' #= Selected ? checked='checked' :'' # />"); ;
                                          }
                                          )
                                          .Editable(editable => editable.Mode(GridEditMode.InCell))
                                          .DataSource(dataSource => dataSource
                                                  .Ajax()
                                                  .Model( m =>
                                                  {
                                                      m.Field(p => p.Id).Editable(false);
                                                      m.Field(p => p.ModuleId).Editable(false);
                                                      m.Field(p => p.Module.Name).Editable(false);
                                                      m.Field(p => p.Name).Editable(false);
                                                      m.Field(p => p.Selected);
                                                  }
                                                  )
                                                  .ServerOperation(false)
                                           )
                                    )

  2. Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 20 Oct Link to this post

    Hello Antonio,

    You've selected the Grid for ASP.NET Core as the Product of the thread. If you are using the MVC Core suite, please try adding the required lines in the Startup.cs as demonstrated in Step 4 here:
    http://docs.telerik.com/kendo-ui/aspnet-mvc/mvc-6/getting-started

    Regardless whether you use MVC 5 or Core, you can use our live samples as a starting reference for implementing editing:
    http://demos.telerik.com/aspnet-mvc/grid/editing
    http://demos.telerik.com/aspnet-core/grid/editing

    I hope this will prove helpful.

    Regards,
    Eyup
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Telerik UI for ASP.NET Core is out
Back to Top