transfer items between TreeViews

2 posts, 0 answers
  1. Di
    Di avatar
    10 posts
    Member since:
    Aug 2010

    Posted 24 Mar 2011 Link to this post

    Hi there,

    I was able to connect to my hierarchical sql data according to demo

    Now I need to transfer the items between two TreeViews, similar to the demo below except for the demo is using ListBoxs:

    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?

  2. Nikolay Tsenkov
    Nikolay Tsenkov avatar
    734 posts

    Posted 28 Mar 2011 Link to this post

    Hello Di,

    You can use drag and drop to populate the second TreeView. Here is a demo on that:

    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:

    Nikolay Tsenkov
    the Telerik team
Back to Top