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

RadTreeView: disable AJAX

3 Answers 131 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Leigh
Top achievements
Rank 1
Leigh asked on 12 Apr 2011, 05:38 PM
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" />

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 13 Apr 2011, 07:06 AM
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.

0
Leigh
Top achievements
Rank 1
answered on 13 Apr 2011, 03:02 PM
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
0
Accepted
Veronica
Telerik team
answered on 18 Apr 2011, 01:52 PM
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.

Tags
TreeView
Asked by
Leigh
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Leigh
Top achievements
Rank 1
Share this question
or