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

Grid using Ajax - Solution to return big json string.

0 Answers 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rene
Top achievements
Rank 1
Rene asked on 09 May 2014, 07:55 PM
Hi,

I thought I'd post this solution here to an issue I was having regarding json strings being to large for return from an MVC endpoint using Kendo Grid and ajax/json/datasourceresult as per a grid (or listivew et al) Read endpoint for ajax:

Instead of doing the following (as per usual):

return Json(dataSourceResult);

use this instead:

return new JsonResult() {
  Data = dataSourceResult,
  ContentType = "application/json",
  ContentEncoding = System.Text.Encoding.UTF8,
  JsonRequestBehavior = JsonRequestBehavior.AllowGet,
  MaxJsonLength = Int32.MaxValue
};

The solution above does not require any web.config changes et al.

Regards,

Rene Pilon

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Rene
Top achievements
Rank 1
Share this question
or