I am trying to get a form containing a Kendo MVC grid and other elements to submit.
IEnumer
I was inspired by codebeastie and @user1878526 to produce the following hybrid idea - simply returning the grid as a list of strings to the controller save action:
Controller:
Function Save(ThisForum As myModel, gridData As List(Of String)) As ActionResult
View:
$("#myForm").submit(function (event) {
var grid = $("#myGrid").data("kendoGrid");
var data = grid.dataSource.view();
var input;
for (var i = 0; i < data.length; i++) {
var s = JSON.stringify(data[i]).replace(/["']/g, "");
input = $("", { type: 'hidden', name: 'data[' + i + ']', value: s });
$(this).append($(input));
}
})
This can then be parsed in the controller reasonably easily by Spliting on commas and colons.