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

Export Excel exceeds maxJson limit

3 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 13 Sep 2016, 12:37 AM

Hello,

I have a grid which displays fine, but when trying to export to excel it exceeds the maxJson limit.  Why can the grid work, but not the export to excel?  Pageable and PageSize(100) on the grid so I'm guessing that the grid brings back data in chunks, but when it tries to export to excel and AllPages(true) that is where the problem is?

Thanks,

John

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 14 Sep 2016, 01:17 PM
Hello John,

A possible solution is to increase the maxJsonLength in your web.config file or use server exporting. You can check out the following how to article which elaborates more on server exporting.

Regards,
Kostadin
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
1
John
Top achievements
Rank 1
answered on 14 Sep 2016, 02:52 PM

Hi Kostadin,

I tried various things like the web.config file but no luck. However,

was able to resolve the issue by overriding the Json method as shown below: 

protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
{
return new JsonResult()
{
Data = data,
ContentType = contentType,
ContentEncoding = contentEncoding,
JsonRequestBehavior = behavior,
MaxJsonLength = Int32.MaxValue
};
}

 

0
Ricardo
Top achievements
Rank 1
answered on 03 Feb 2021, 06:04 PM
Excelent. Works good
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
John
Top achievements
Rank 1
Ricardo
Top achievements
Rank 1
Share this question
or