This is a migrated thread and some comments may be shown as answers.

Post Grid Data not working

1 Answer 185 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Antonio Avanic
Top achievements
Rank 2
Antonio Avanic asked on 18 Oct 2016, 04:04 AM
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)
                                       )
                                )

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 20 Oct 2016, 05:41 AM
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
Tags
Grid
Asked by
Antonio Avanic
Top achievements
Rank 2
Answers by
Eyup
Telerik team
Share this question
or