RadTreeView: disable AJAX

4 posts, 1 answers
  1. Leigh
    Leigh avatar
    10 posts
    Member since:
    Jan 2011

    Posted 12 Apr 2011 Link to this post

    Hello,

    I have a RadTreeView control in my application that can potentially contain a large number of nodes.  When it does contain a large number of nodes, I get the error:

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

    Normally, I would increase the maxJsonLength value in my web.config, however my application is being installed into SharePoint Central Administration as a feature, and I cannot modify maxJsonLength in Central Admin's web.config for a variety of reasons.

    I would like to disable AJAX completely so that JSON serialization is not used - it's okay if the control takes a while to load, plus I am limiting the user to merely expanding and selecting nodes.  Is this possible?

    Thanks,
    Leigh

    The treeview definition (nodes are added in code during page load):

    <telerik:radtreeview id="ScopeTreeView" runat="server" checkboxes="false" multipleselect="false"
                        allownodeediting="false" registerwithscriptmanager="false" visible="true" />
  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 13 Apr 2011 Link to this post

    Hello Leigh,

    RadTreeView (as well as most of our ASP.NET AJAX controls) renders some JavaScript code in JSON format required to initialize the nodes. That's why I don't think that there is a way to remove the JSON serialization at all. As a workaround I suggest you to use Web Service Load-On-Demand shown in this demo.

    Regards,
    Veronica Milcheva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Leigh
    Leigh avatar
    10 posts
    Member since:
    Jan 2011

    Posted 13 Apr 2011 Link to this post

    Thanks Veronica.

    I'm not able to set up a web service at the moment, so perhaps I'll reconsider changing the maxJsonLength value.  In the Microsoft docs (http://msdn.microsoft.com/en-us/library/system.web.configuration.scriptingjsonserializationsection.maxjsonlength(v=VS.90).aspx), it says:

    "The value of the MaxJsonLength property applies only to the internal JavaScriptSerializer instance that is used by the asynchronous communication layer to invoke Web services methods."

    Do Telerik controls use the internal JavaScriptSerializer instance, i.e., does changing the MaxJsonLength property in my web.config have any effect on my RadTreeView?

    Thanks again,
    Leigh
  4. Answer
    Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 18 Apr 2011 Link to this post

    Hi Leigh,

    Yes, we use JavaScriptSerializer to serialize and deserialize the RadTreeView nodes. You got this error: "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property". That's because the JSON output of X RadTreeNodeData objects is too large. As a workaround you need to increase the maxJsonLength property.

    Greetings,
    Veronica Milcheva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top