Limit TreeView depth during drag and drop

2 posts, 0 answers
  1. bman
    bman avatar
    6 posts
    Member since:
    May 2007

    Posted 13 May Link to this post

    I have two TreeViews which have drag and drop enabled. I am trying to limit the depth when someone tries to drag a branch to the other tree.


    TreeA (root)

      TreeA.1.0 (child; level 1)

        TreeA.1.1 (child; level 2)


    TreeB (root)

      TreeB.1.0 (child; level 1)

        TreeB.1.1 (child; level 2)


    Given the above two trees and I desire to only have nodes up to 3 levels deep (ie. no deeper than child level 2) If a user drags "TreeB.1.0" under "TreeA.1.1" then TreeA will have children 4 levels deep.

    I see events Drag and Drop which allow me to validate the destination tree to prevent this. I tried to implement custom data elements as HtmlAttributes in my OnDemand TreeViewItemModel DataSource in server-side code:

    TreeViewItemModel node = new TreeViewItemModel();


    node.HtmlAttributes.Add(new KeyValuePair<string, string>("data_level", level.ToString()));




  2. Helen
    Helen avatar
    1052 posts

    Posted 16 May Link to this post

    Hi Brian,

    Did you review the  following blog post, which discusses a similar topic:

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET AJAX banner
Back to Top