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. Image for the cookie policy date
close icon

Copying Nodes from TreeViewAdv to another

I wanted to copy nodes from a treeviewadv to aother: - tree1.AddRange(tree2.Nodes) moves the nodes to the first. i.e. nodes disappear from second. - tree1.InsertRange() same as above. - tree1.Nodes = tree2.Nodes.Clone() does not work as Nodes collection is read-only. - tree2.CopyTo() needs a one-dimentional array - tree1.AddRange (tree2.Nodes.Clone()) does not work Any other suggestions? Thanks

3 Replies

AD Administrator Syncfusion Team October 8, 2004 10:44 AM UTC

Hi Ahmad, You could acoomplish this as shown below : foreach (TreeNodeAdv node in this.treeViewAdv1.Nodes[0].Nodes) { TreeNodeAdv tna = node.Clone(); this.treeViewAdv2.Nodes[0].Nodes.Add(tna); } Please refer to the test sample that illustrates this and let me know if this works for you. Regards, Guru Patwal Syncfusion, Inc.


A( Abdulrahman (Ahmad) Alsaleem October 8, 2004 12:37 PM UTC

Got it. I also modified the code above to yield : foreach (TreeNodeAdv tmpNode in tree2.Nodes) { tree1.Add(tmNode.Clone() as TreeNodeAdv); } Thanks for the help.


AD Administrator Syncfusion Team October 8, 2004 01:12 PM UTC

Hi Ahmad, Thanks for the update. Please let me know if you need any other information. Thanks for your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon