We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Copying ejTreeView exact contents to secodn ejTreeView

Thread ID:





128307 Jan 12,2017 11:46 PM UTC Jan 18,2017 12:20 PM UTC JavaScript 1
Tags: ejTreeView
Marc Call
Asked On January 12, 2017 11:46 PM UTC

I am using an ejTreeView in my ASP.NET project.
I have 1 tree view that the user uses on one page, and then I want to display a second tree view with all the same data on the following page as a confirmation of what they had chosen on the 1st treeview.

How can I easily copy / duplicate my treeview with all its content and selections to a second treeview?

Piramanayagam Ramakrishnan [Syncfusion]
Replied On January 18, 2017 12:20 PM UTC

Hi Marc, 
Thanks for contacting Syncfusion support. 
We have analyzed your query. We can achieve your requirement (“How can I easily copy / duplicate my treeview with all its content and selections to a second treeview”) in TreeView control by using getTreeData public method.  
This method is used to get updated data source after performing some operation such as drag and drop, node editing, adding and removing node from client side in TreeView. It will return the updated data source as JSON array object. Please refer the below code sample, 
var treeobj = $("#<%=Treeview.ClientID%>").data("ejTreeView"); 
var dataSource = treeobj.getTreeData(); 
var treedata = JSON.stringify({ sessionval: dataSource }); 
We can save this data source into session. We can retain this data source from session in another page and assign this data source to another TreeView. 
For more details on the getTreeData method, please refer to the help document link:
For your reference, we have prepared a sample based on this, and it can be downloaded from the following location: Sample 
Please let us know whether the provided sample is helpful in achieving your requirement. If not, get back to us with more information to proceed further. 
Piramanayagam R


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon