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

Treeview Drag and drop in a same hirarchial level

1 Answer 122 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
parvati
Top achievements
Rank 1
parvati asked on 10 Jul 2009, 06:16 AM
Hello,
I need to use tree view to dsipaly the category structure in my web applicaion. I want the user to change the order of categories in the same level.
Example:
                        Accessories
                        ....Business Gifts
                        Apparel
                        ....Hats
                        ....shirts
                        ....Jackets


This is my category structure. If i try with telerik treeview it allows me to drag the Hats category and place it under accessories. but  my requiremnet is i should be able to change only the position of hats, shirts and Jackets(categories of same level in a catategory) and should not allow to change the category structure across different categories.
can any one help on this

Regards,
Parvati


1 Answer, 1 is accepted

Sort by
0
Mr. Plinko
Top achievements
Rank 1
answered on 04 Aug 2009, 07:02 PM
My set up is where the dragged node swaps places with the node it is dropped on. Maybe you can customize it to do as you need

using Telerik.Web.UI; 
 
public partial class Default2 : System.Web.UI.Page 
 
    protected void RadTreeView1_NodeDrop(object sender, Telerik.Web.UI.RadTreeNodeDragDropEventArgs e) 
    { 
        RadTreeNode source = e.SourceDragNode; 
        RadTreeNode dest = e.DestDragNode; 
 
        RadTreeNode DraggedNode = new RadTreeNode(); 
        DraggedNode.Text = source.Text; 
        DraggedNode.Value = source.Value; 
 
        source.Text = dest.Text; 
        source.Value = dest.Value; 
 
        dest.Text = DraggedNode.Text; 
        dest.Value = DraggedNode.Value; 
    } 

Helpful?
Tags
TreeView
Asked by
parvati
Top achievements
Rank 1
Answers by
Mr. Plinko
Top achievements
Rank 1
Share this question
or