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

Serializing grid data to json string

1 Answer 684 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shabtai
Top achievements
Rank 1
Shabtai asked on 25 Jun 2013, 07:57 AM
Hi,

I'm trying to implement grid serialization example:
http://stackoverflow.com/questions/10324565/how-to-get-the-displayed-data-of-kendogrid-in-json-format

$.ajax({
    type: 'post',
    data: kendo.stringify($("#Grid").data("kendoGrid").dataSource.view()),
    dataType: "json",
    contentType: "application/json; charset=utf-8",
    url: '@Url.Action("CreateExcelFile","Helper")',
    success: function (response) {
    },
    error: function (request, status, errorThrown) {
    }
});
On server side I get, Request.Form.Count = 0...

Any help would be appreciated...

Thanks
Shabtai

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 27 Jun 2013, 07:51 AM
Hello Shabtai,

The form data will be empty since you are posting the data as JSON. You should use the model binder to get the items on the server:

public ActionResult Action(IEnumerable<MyModel> models)
{

You should also use the toJSON method to convert the view to an array of plain JavaScript objects. Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Shabtai
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or