This snippet should be called as a create/update data formatter:
View
@(Html.Kendo().Grid() .DataSource(c => c.Ajax() .Create(...).Data("serialize")) .Update(...).Data("serialize")) ...)
JavaScript
function serialize(data) { if (data.FIELD_NAME != null) { var selected = data.FIELD_NAME; // Remove the old value to prevent binding conflicts. delete data.FIELD_NAME; // Select out the values. for (var i = 0; i < selected.length; i++) { // Rebuild the field in a format friendly to ASP.Net MVC. data["FIELD_NAME[" + i + "]"] = selected[i].Value } } }
No comments:
Post a Comment