Drag'n drop from datalist to treeview

4 posts, 0 answers
  1. jc mag
    jc mag avatar
    106 posts
    Member since:
    Aug 2005

    Posted 26 Jan 2011 Link to this post

    I have a page with a DataList and a RadTreeView and now I should allow drag'n drop from datalist's items to the treeview. I wonder what is the best approach to do this:
    1/ using custom javascript
    2/ replacing the DataList with a RadListView, to do the same as this: http://demos.telerik.com/aspnet-ajax/listview/examples/itemdragdrop/defaultcs.aspx

    What is the easiest and fastest method?
  2. Dimitar Terziev
    Dimitar Terziev avatar
    1266 posts

    Posted 31 Jan 2011 Link to this post

    Hello Jc,

    It's better to use RadListView along with the RadTreeView , since both of the controls support drag'n'drop functionality. In order to use this functionality of the ListView , first you should enable it using the following AllowItemsDragDrop="true" property . Also you should add RadListViewItemDragHandle control to your ListView. In order to enable the drag-and-drop functionality of the RadTreeView you should set EnableDragAndDrop="true" property. When the RadTreeView detect a valid drag-and-drop operation it fires a server-side event NodeDrop , where you should perform the desired action.
    You have already pointed the demo for the ListView , but there is also e another demo for TreeView drag-and-drop here. Also you could check these two help articles here and here.

    All the best,
    Dimitar Terziev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. DevCraft R3 2016 release webinar banner
  4. Sean
    Sean avatar
    51 posts
    Member since:
    May 2008

    Posted 12 Jul 2013 Link to this post

    How might I do the inverse? I want drag from the treeview to the listview
  5. Dimitar Terziev
    Dimitar Terziev avatar
    1266 posts

    Posted 17 Jul 2013 Link to this post

    Hi Sean,

    You should be able to drag from the RadTreeView and drop in the RadListView, using a similar logic as the one suggested in my previous post. Both control relies on events for their drag-n-drop operations, so you should handle these event and use your custom logic in order to achieve the desired functionality.

    Dimitar Terziev
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top