"[Bind(Prefix = "models")] " in https://demos.telerik.com/aspnet-core/grid/editing
I strictly followed the code in this page, but my save updates doesn't work.
1 Answer, 1 is accepted
0
Georgi
Telerik team
answered on 24 May 2019, 01:24 PM
Hello Sarah,
By default the grid sends the unsaved items in a parameter called `models`.
For example:
models[0].ProductID: 1
models[0].ProductName: Chaifdsa
models[0].UnitPrice: 18
models[0].UnitsInStock: 39
models[0].Discontinued: false
models[0].LastSupply: 5/24/2019 3:00:00 AM
models[0].UnitsOnOrder: 0
models[0].Category.CategoryID: 1
models[0].Category.CategoryName: Beverages
models[0].CategoryID: 1
models[0].QuantityPerUnit: 10 boxes x 20 bags
And we use the Bind attribute, to bind the incoming data to a collection of models.
Could you please make sure that Batch is enabled in your DataSource?
e.g.
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
When batch is enabled the grid will format the request as above and the Bind attribute should bind the data to the parameter.
I hope this helps.
Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.
For some reason this does not work for us; we receive a list with the correct amount of elements on the server side, but each element ist null.
On the other hand, When we don't use .Batch(true), we correctly receive one object containing the data.
Any ideas where this behaviour might come from?
(I suspect a more general ASP.NET MVC problem though, not a problem with Kendo, as the values seem to be posted correctly to the server, but the subsequent deserialization seems to fail...)
Georgi
Telerik team
commented on 12 Jan 2022, 01:38 PM
Hello, Stefan,
This could happen if the data is culture-specific and both client and server are not using the same culture.
However, I am not certain that is the case here. Could you please share your configuration with us so we can examine it?