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

get xml client side

6 Answers 69 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kieran
Top achievements
Rank 1
Kieran asked on 14 Jan 2010, 10:52 PM
Hi

Is there anyway of rendering the xml representation of a treeview using javascript? maybe using json/jayrock?

The xml can be obtained when a node is expanding however as the trewview isn't set to serverside the collapse node event is not fired. Is thereanyway around this? Need to store the state of the treeview which works fine when a user expands a node but when they collapse a node the change can not be captured

Any help much appreciated? It is not viable to put the treeview in an updatepanel

Thanks
Kieran

6 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 19 Jan 2010, 12:10 PM
Hi Kieran,

The current version of RadTreeView does not have a method to convert the state of the tree to XML with javascript. There is a server method - GetXml() which does exactly what you need.

Can you elaborate a bit more about your exact scenario so we can think of any alternative approaches?

Kind regards,
Veskoni
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
John
Top achievements
Rank 1
answered on 29 Jan 2010, 01:16 AM
I too have a need for getting the XML of a tree client side.

In my scenario I have RadMenu with a RadTree inside of the drop down.  I wish to save the Tree State Server side on expand/collapse.  I originally put it in an ajaxpanel but when the ajax postback occurs, my Radmenu would close on me.  So what I would like to do is use a RadXmlHttpPanel do the saving for me since I don't really need a full post back or to do anything with the results, just fire, save, and forget.


So I have an RadXMLHTTPPanel with nothing in it, and an OnServiceRequest method that does the saving.  But I can't get the state of the tree from the OnServiceRequest since the radxmlhttppanel doesn't know what it is.

So I figured I could use OnClientNodeCollapsed and OnClientNodeExpanded methods of the tree to call the RadXmlhttpPanel to send it the state.

        function RadTreeView_Admin_NodeChange(sender, eventArgs) { 
            var panel = $find("<%=RadXmlHttpPanel1.ClientID%>"); 
            var txt =  eventArgs.getXML(); 
            panel.set_value(txt); 
        } 

but since there is no client side getXML, i'm out of luck.

Any ideas on how to accomplish this?

0
Accepted
Veselin Vasilev
Telerik team
answered on 03 Feb 2010, 03:29 PM
Hi John,

Please download a sample project from here.

Regards,
Veskoni
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
John
Top achievements
Rank 1
answered on 03 Feb 2010, 05:07 PM
Thanks Veskoni that works, my original approach had I made it way more complicated then it needed to be.  Thanks

John
0
D
Top achievements
Rank 1
answered on 04 Jun 2012, 08:23 PM
Any chance an example of this is still around? Need to do the same thing.
0
Plamen
Telerik team
answered on 07 Jun 2012, 09:18 AM
Hello D,

 
It seems that the example is not available. Would you please elaborate a little bit what exactly are you trying to achieve so we can try to provide you with the appropriate solution?

All the best,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
TreeView
Asked by
Kieran
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
John
Top achievements
Rank 1
D
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or