Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for ASP.NET Web Forms / Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

New Discussion
Rajesh Thangapandian
Rajesh Thangapandian asked on Jan 10, 2018 11:07 AM

I am using Infragistics v16.1 and have encountered an issue where i have a web data grid with 25 columns and 1000 blank rows. After copy/paste 1000 records from excel and click submit button getting below error: “Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.”.

I already set EnableAjax=”false” and EnableAjaxViewState=”false” and added _callbackManager.setTimeout(600000) in web data grid initialize function.

I already went through some of the posts regarding the same , but not able to find any solutions.

How to fix this issue.should I be able to find this in any documentation?

cheers

Rajesh

 

Sign In to post a reply

Replies

  • 0
    Rajesh Thangapandian
    Rajesh Thangapandian answered on Jan 18, 2017 5:42 PM

    i have tried below steps also but no luck:

    • Added <jsonSerialization maxJsonLength="2147483644"/> in Web.config
    • Added <add key="aspnet:MaxJsonDeserializerMembers" value="2147483644"/> in web.config
    • 0
      Zdravko Kolev
      Zdravko Kolev answered on Jan 23, 2017 1:01 PM

      Hello Rejesh,

      Thank you for your question.

      Keep in mind that on paste operation, copied columns from the excel file, should match the selected WebDataGrid cells (have a look at the attached image below).

      Also the data should match, if you have date value in one od the cells and you pass some string, the serialization will fail.

      You can try to modify the attached sample in order to reproduce the issue and I will be able to help you further with it.

      Image:

      • 0
        Rajesh Thangapandian
        Rajesh Thangapandian answered on Jan 23, 2017 4:16 PM

        The issue is not on copy/paste. The copy paste is working fine. the exception happening on button click.

         I am using Infragistics v16.1. Please find the attached solution with an excel file with data for 1000 rows.

         Please run the application and copy/paste 1000 rows in the grid. The exception will be thrown after button click. (i.e. Maximum request length exceeded).

         As per client, they wants minimum 1000 rows for bulk submit. 

        All the works are done except this exception, please help on this.

      • 0
        Rajesh Thangapandian
        Rajesh Thangapandian answered on Jan 24, 2017 8:41 AM

        Hi Zdravko Kolev,

        I forgot to add the below line in previously attached solution.But I have this line in my application for increase the timeout to 10 min and the logic is inside WebDataGridView_Initialize method.

        <ClientEvents KeyUp="keyUp" Initialize="WebDataGridView_Initialize" />

        Please add this line in previously attached solution to replicate the issue.

        Cheers,

        Rajesh

      • 0
        Zdravko Kolev
        Zdravko Kolev answered on Jan 26, 2017 9:14 AM

        Hello Rajesh,

        Thank you for the sample and detailed information on how to reproduce the issue.

        Better approach when handling this amount of data is to proceed the upload of the file on the server, and not copy/paste it. I have created a sample in order to show you what I mean. I hope you will find the sample helpful.

        Let me know if I could be of further assistance.

      • 0
        Rajesh Thangapandian
        Rajesh Thangapandian answered on Jan 26, 2017 11:19 AM

        Hallo Zdravko Kolev,

        Thanks for this approach.

        But is there any way we can handle this exception and overcome the inbuilt JSON length limit during serialization of a web dataGridView content?

        Our client wants to copy/paste the data into the grid.

        Please help on this.

        Cheers,

        Rajesh

      • 0
        Zdravko Kolev
        Zdravko Kolev answered on Jan 27, 2017 3:16 PM

        I will try a couple more things and will let you know about the results.

      • 0
        Rajesh Thangapandian
        Rajesh Thangapandian answered on Jan 28, 2017 8:23 AM

        Sure Zdravko Kolev…Please let me know if you find any solution for this…

      • 0
        Rajesh Thangapandian
        Rajesh Thangapandian answered on Feb 1, 2017 8:45 AM

        Hi  Zdravko Kolev…any updates on this?

      • 0
        Zdravko Kolev
        Zdravko Kolev answered on Feb 1, 2017 9:53 AM

        Hello Rajesh,

        Thank you for your patience.

        The issue is caused because of the serialization and de-serialization of returned objects. Serialization converts .net objects to XML format and when the data length exceed the limit of serialization, error is thrown. Basically our WebDataGrid has a limitation and he could not handle more than 1000 rows and 12 columns. I have used the configuration below in order to achieve this result.

        Web.config:

        ….

        <httpRuntime maxRequestLength=”2147483647″ />
        <system.webServer>
        <security>
        <requestFiltering>
        <requestLimits maxAllowedContentLength=”4294967295″></requestLimits>
        </requestFiltering>
        </security>
        </system.webServer>
        <system.web.extensions>
        <scripting>
        <webServices>
        <jsonSerialization maxJsonLength=”2147483647″></jsonSerialization>
        </webServices>
        </scripting>
        </system.web.extensions>
        </configuration>

        My suggestions are to follow different approaches when it comes to commit this amount of data at once:

        – reduce the portions of data not to be saved at once.

        – performed the data operations on the server directly (have a look at the attached sample from my previous reply).

        – use our Ignite UI igGrid widget, which is client based component.

  • 0
    Jordyn
    Jordyn answered on Sep 26, 2017 8:34 AM

    The serialization and de-serialization of returned objects might be the isssue. Check or validate your JSON here also:  JSON Formatter

  • 0
    html
    html answered on Oct 26, 2017 4:09 PM

    Oh, great, your article gives me useful information and a fresh perspective on the subject.

    wings io

    • 0
      Veronica
      Veronica answered on Nov 2, 2017 8:24 AM

      This is a great article, that I really enjoyed reading. Thanks for sharing.  fnaf world

  • 0
    yify
    yify answered on Nov 20, 2017 7:36 AM

    I think this is an informative post and it is very useful and knowledgeable. I really enjoyed reading this post. big fan, thank you!
    yify

  • 0
    jack
    jack answered on Nov 29, 2017 7:49 PM
    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.
    ************** Exception Text **************
    System.NullReferenceException: Object reference not set to an instance of an object.
    at Infragistics.Win.UltraWinGrid.UltraGrid.SynchImeMode(Boolean restoreOnly)
    at Infragistics.Win.UltraWinGrid.UltraGrid.OnAfterExitEditMode()
    at Infragistics.Win.UltraWinGrid.UltraGrid.FireEvent(GridEventIds id, EventArgs e)
    at Infragistics.Win.UltraWinGrid.UltraGridLayout.OnEditorAfterExitEditMode(Object sender, EventArgs e)
    at Infragistics.Win.EmbeddableEditorBase.OnAfterExitEditMode()
    at Infragistics.Win.EmbeddableEditorBase.ExitEditMode(Boolean forceExit, Boolean applyChanges)
    at Infragistics.Win.UltraWinGrid.UltraGridCell.ExitEditMode(Boolean cancellingEditOperation, Boolean forceExit)
    at Infragistics.Win.UltraWinGrid.UltraGridCell.ExitEditMode()
    at Infragistics.Win.UltraWinGrid.UltraGrid.ClearActiveCell(Boolean invalidate, Boolean shutdown)
    at Infragistics.Win.UltraWinGrid.UltraGrid.set_ActiveCell(UltraGridCell value)
    at Infragistics.Win.UltraWinGrid.UltraGridRow.Activate()
    at Infragistics.Win.UltraWinGrid.UltraGridRow.SetFocusAndActivate(Boolean byMouse, Boolean enterEditMode, Boolean byTabKey)
    at Infragistics.Win.UltraWinGrid.UltraGridRow.SetFocusAndActivate()
    at Infragistics.Win.UltraWinGrid.UltraGrid.Infragistics.Win.ISelectionManager.ActivateItem(ISelectableItem item)
    at Infragistics.Win.SelectionStrategyExtended.OnMouseDown(ISelectableItem item, MouseMessageInfo& msginfo, Boolean forceDrag)
    at Infragistics.Win.SelectionStrategyExtended.OnMouseDown(ISelectableItem item, MouseMessageInfo& msginfo)
    at Infragistics.Win.SelectionStrategyExtended.OnMouseMessage(ISelectableItem item, MouseMessageInfo& msginfo)
    at Infragistics.Win.ControlUIElementBase.ProcessMouseDownHelper(Object sender, MouseEventArgs e)
    at Infragistics.Win.ControlUIElementBase.ProcessMouseDown(Object sender, MouseEventArgs e)
    at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
    at Infragistics.Win.UltraWinGrid.UltraGrid.OnMouseDown(MouseEventArgs e)
    at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1080.0 built by: NETFXREL3STAGE
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
    —————————————-
    Microsoft.VisualStudio.HostingProcess.Utilities
    Assembly Version: 14.0.0.0
    Win32 Version: 14.0.23107.0
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.HostingProcess.Utilities/14.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.HostingProcess.Utilities.dll
    —————————————-
    System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1038.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    —————————————-
    Microsoft.VisualStudio.HostingProcess.Utilities.Sync
    Assembly Version: 14.0.0.0
    Win32 Version: 14.0.23107.0
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.HostingProcess.Utilities.Sync/14.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll
    —————————————-
    System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/Syst
  • 0
    Kavya Sharma
    Kavya Sharma answered on Jan 10, 2018 11:07 AM

    Amazing Post! it is really knowledgeable and useful for me. Thanks for sharehttp://proactdigital.com

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Rajesh Thangapandian
Favorites
0
Replies
16
Created On
Jan 10, 2018
Last Post
8 years, 1 month ago

Suggested Discussions

Created on

Jan 10, 2018 11:07 AM

Last activity on

Feb 23, 2026 8:48 AM