Export Excel exceeds maxJson limit

3 posts, 0 answers
  1. John
    John avatar
    12 posts
    Member since:
    Jul 2016

    Posted 12 Sep Link to this post

    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

  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 14 Sep Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. John
    John avatar
    12 posts
    Member since:
    Jul 2016

    Posted 14 Sep in reply to Kostadin Link to this post

    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
    };
    }

     

Back to Top