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

transfer items between TreeViews

1 Answer 54 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Di
Top achievements
Rank 1
Di asked on 24 Mar 2011, 12:46 PM
Hi there,

I was able to connect to my hierarchical sql data according to demo
http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/databinding/defaultcs.aspx.

Now I need to transfer the items between two TreeViews, similar to the demo below except for the demo is using ListBoxs:
http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/transfer/defaultcs.aspx

But I need to keep the hierarchy information during transfer. Say, if the item belongs to group1 in TreeView1, it will also be shown as group1 item in TreeView2 after transfered to TreeView2.

TreeView2 is blank at first, after finished selecting data from TreeView1, I would like to write everything in TreeView2 to database with hierarchy info.

How could I accomplish that?

Thanks,
Di

1 Answer, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 28 Mar 2011, 04:44 PM
Hello Di,

You can use drag and drop to populate the second TreeView. Here is a demo on that: http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/draganddropnodes/defaultcs.aspx

The only difference would be that you need to copy the node instead moving it - you can clone the node and add the new clone to the secondTreeVIew.

Also as the TreeView is empty at the beginning - you can add a node which will state "Drag Nodes Here" and after nodes are being dragged, to remove the node from the TreeView. In order to get the drop event you can handle the NodeDrop of the TreeView. Here is a documentation article regarding this event: http://www.telerik.com/help/aspnet-ajax/e_telerik_web_ui_radtreeview_nodedrop.html


Regards,
Nikolay Tsenkov
the Telerik team
Tags
ListView
Asked by
Di
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Share this question
or