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

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

4 Answers 190 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Makoto
Top achievements
Rank 1
Makoto asked on 19 Mar 2010, 04:37 PM
I have a master file that has the following markup towards the bottom:

     <% Html.Telerik().ScriptRegistrar().DefaultGroup(group => group 
    .Add("~/Scripts/MicrosoftAjax.js") 
    .Add("~/Scripts/MicrosoftMvcAjax.js") 
    .Add("~/Scripts/jquery-ui-1.7.2.custom.min.js") 
    .Combined(true) 
    .Compress(true) 
    .CacheDurationInDays(1) 
    ).Render(); %> 
</body> 


On my .aspx content page, I have a Grid that uses Ajax DataBinding. 

   <% Html.Telerik().Grid(this.Model) 
            .Name("MemberGrid") 
            .DataKeys(keys => keys.Add(c => c.Id)) 
            .DataBinding(config => config 
                .Server() 
                        .Select("MemberIndexAjax") 
                        .Update("MemberUpdateAjax") 
            ) 
            .Columns(col => 
            { 
                col.Bound(o => o.FirstName).Title("First Name"); 
                col.Bound(o => o.LastName).Title("Last Name"); 
                col.Bound(o => o.Email).Title("Email"); 
                col.Bound(o => o.MemberActive).Title("Active"); 
                col.Command(action => action.Edit()).Title("Edit"); 
            }).Render(); %> 


When I do this, I get the following error from the ScriptRegistrar:

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

Line 69:        <% Html.Telerik().ScriptRegistrar().DefaultGroup(group => group
Line 70:     .Add("~/Scripts/MicrosoftAjax.js")
Line 71:     .Add("~/Scripts/MicrosoftMvcAjax.js")

This doesn't happen when I choose Server() DataBinding, but does also happen for WebService() DataBinding as well.




4 Answers, 1 is accepted

Sort by
0
IQworks
Top achievements
Rank 1
answered on 21 Mar 2010, 05:46 AM

 Hi Makoto,
      I am just guessing here because i have never had this error. But, I did take a google look with this search .....
(please excuse me if you have already done this) 
     "The length of the string exceeds the value set on the maxJsonLength property".
      i see references to checking your web.config, and one link mentions webservice as well. I send you these because you didnt mention your web.config - so i didnt know if you where aware of this piece.

      Here are the links I saw ....

      http://dotnetstep.blogspot.com/2008/08/jsonserialization-error-solution.html 
      http://forums.asp.net/p/1356198/2782837.aspx 
      http://www.smallworkarounds.net/2009/04/error-during-serialization-or.html 

     Any way, good luck.
     

0
Makoto
Top achievements
Rank 1
answered on 25 Mar 2010, 09:38 PM
Thanks.

I figured out the issue.  I was serializing a complex class that has child classes and collections.  I guess this was too much to serialize.  What I had to do was create another class that just has the simple types that I want to display on the screen.  Now that I did that, it works.

I've actually been very pleased with the Telerik line of products and am evaluating using the Telerik MVC controls and OpenAccess ORM for our company.  We are currently using a variety of jQuery controls from different sources and it'd be nice to just have one control suite from a trusted company.  Also, we're currently using Microsoft's Entity Framework as our ORM and personally, I am not happy with it at all.  The SQL queries that it generates are very inefficient and slow as well and doesn't provide nearly as many nice features that OpenAccess does.

0
kannan
Top achievements
Rank 1
answered on 16 Aug 2011, 06:57 AM
Hello Telerik Support,

 I am also getting the same error

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

for loading 5000 records in multicolumn ddl no error .morethan 5000 getting this error .

how can i solve this

thanks in advance
kannan
0
David
Top achievements
Rank 1
answered on 06 Aug 2012, 08:07 AM
Try this.
Tags
Grid
Asked by
Makoto
Top achievements
Rank 1
Answers by
IQworks
Top achievements
Rank 1
Makoto
Top achievements
Rank 1
kannan
Top achievements
Rank 1
David
Top achievements
Rank 1
Share this question
or