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.1.0 (child; level 1)
TreeA.1.1 (child; level 2)
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()));