Treeview Drag and drop in a same hirarchial level

2 posts, 0 answers
  1. parvati
    parvati avatar
    4 posts
    Member since:
    Jan 2009

    Posted 10 Jul 2009 Link to this post

    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


  2. Mr. Plinko
    Mr. Plinko avatar
    56 posts
    Member since:
    Jul 2009

    Posted 04 Aug 2009 Link to this post

    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?
Back to Top