RadTreeView: draggin node between trees without deleting it from source

2 posts, 0 answers
  1. Santiago Pesantez
    Santiago Pesantez avatar
    1 posts
    Member since:
    Mar 2010

    Posted 26 Mar 2012 Link to this post

    I have 2 radtreeview controls in a site, and want to copy one node the other tree control by drag/drop functionality but the source node is being deleted from the source node (cut/paste), I want to emulate the copy functionality, without deleting the node form the source.
    Thanks in advance for the help.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Mar 2012 Link to this post


    Try the following JavaScript to copy nodes between RadTreeViews.

    <script type="text/javascript">
     function OnClientNodeDropping(sender, args)
       var sourceNode = args.get_sourceNode();
       var destNode = args.get_destNode();  
         var newNode = new Telerik.Web.UI.RadTreeNode();
         CloneNode(newNode, sourceNode);
     function CloneNode(newNode, sourceNode)
       if (sourceNode.get_nodes().get_count()>0)
         for (var i = 0; i < sourceNode.get_nodes().get_count(); i++)
           var node = sourceNode.get_nodes().getNode(i);
           var newChildNode = new Telerik.Web.UI.RadTreeNode();
           CloneNode(newChildNode, node);

    Note: Set EnableDragAndDrop property of RadTreeView to true.

Back to Top