views:

4219

answers:

4
+11  A: 

The MaxJsonLength property cannot be unlimited, is an integer property that has by default 2097152 characters (approx. 4MB of data).

You can set the MaxJsonLength property on your web.config:

<configuration> 
   <system.web.extensions>
       <scripting>
           <webServices>
               <jsonSerialization maxJsonLength="50000000"/>
           </webServices>
       </scripting>
   </system.web.extensions>
</configuration> 
CMS
They could have used zero to mean unlimited :-)
djna
It is an integer so the max value you can set is: 2147483644
despart
+7  A: 

You can configure the max length for json requests in your web.config file:

<configuration>
    <system.web.extensions>
        <scripting>
            <webServices>
                <jsonSerialization maxJsonLength="....">
                </jsonSerialization>
            </webServices>
        </scripting>
    </system.web.extensions>
</configuration>

The default value for maxJsonLength is 102400. For more details, see this MSDN page: http://msdn.microsoft.com/en-us/library/bb763183.aspx

M4N
+1  A: 

The question really is whether you really need to return 17k records? How are you planning to handle all the data in the browser? The users are not going to scroll through 17000 rows anyway.

A better approach is to retrieve only a "top few" records and load more as needed.

Chetan Sastry
The default list from json will give 17k records. But the autocomplete feature will list only the records that matches the characters that the user types, thus it wont need to scroll the list more.SO what i need is to set unlimited length for maxJsonLength which can serialize the 17k data.
Prasad
You could use a combination of server and client side filtering. It could be hard to filter all the data on the client side, not to mention the network latency.
Chetan Sastry
+1  A: 

It appears that there is no "unlimited" value. The default is 2097152 characters, which is equivalent to 4 MB of Unicode string data.

As as already been observed, 17,000 records are hard to use well in the browser. If you are presenting an aggregate view it may be much more efficient to do the aggregation on the server and transfer only a summary in the browser. For example, consider a file system brower, we only see the top of the tree, then emit further requestes as we drill down. The number of records returned in each request is comparatively small. A tree view presentation can work well for large result sets.

djna