We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

catch 22 maxJsonLength

Hi all, 

i'm facing "The length of the string exceeds the value set on the maxJsonLength property" when i'm trying to display a big report.

i did some tricks like setting the web.config as below:
<configuration> 
   <system.web.extensions>
       <scripting>
           <webServices>
               <jsonSerialization maxJsonLength="2147483644" />
           </webServices>
       </scripting>
   </system.web.extensions> 
</configuration>




but no luck.  

As JsonResult class and ReportViewerHtmlActionResult class Inheritance from ActionResult,

i can override the json in the controller as 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
    }; 
}
but because i need to return a ReportViewerHtmlActionResult  i cannot set the maxJsonLength :(

how do you guys display a big report?
i look the sample but my report is away bigger.

any sample code?

Kind regards Aleixo

PS i'm using VS 2013 with MCV 5 






1 Reply

AS Anandakumar S Syncfusion Team July 16, 2014 01:00 PM UTC

Hi Merlon,

We have already provided Page Virtualization support for loading large reports and internally we have set the default json length to render reports quickly. So we request you to enable the pagevirtualization option for loading large reports as show in below Code Snippet:

@{Html.Syncfusion().ReportViewer("ViewerId", (ReportViewerModel)ViewData["ReportModel"]).EnablePageVirtualization(true).Render();}

 Here is a sample that works as expected.

http://www.syncfusion.com/downloads/support/directtrac/123979/ReportViewerMVC_7a6bbdca.zip

 Please let us know if you have any questions.

Regards,

Anandakumar S


Loader.
Live Chat Icon For mobile
Up arrow icon