Above is an example of my treeview I'm working with. I would like to conditionally enable/disable drag and drop functionality per node type.
If a node is an item:
- it can be dragged into (over) a node that is empty or already has other items in it
- it can be dragged next to (above/below) a node that is
If a node is a category:
- it can be dragged into (over) a node as long as that destination node does not have item child nodes
Is there any way to set this in code when the page loads either through code or attributes? I have dropping disabled on all item nodes. I know that I can check the node types on postback, but I'm wanting to not let the user perform the drop initially based on the above criteria, therefore eliminating the unnecessary postback. Please help.
7 Answers, 1 is accepted
You could handle this in "OnClientNodeDropping" event of RadTreeView. You cna easily cancel the event using "set_cancel()" method based on your conditions.
A more clear idea, you will get by going through the documentation.
Maybe as a future idea for the treeview, have a field (perhaps using the Category field) that tells the node it can only accept, for dropping, nodes of a specified type or types.
This functionality is not that trivial to achieve. You will need to handle at least 2 events and on each drag and drop to traverse the entire TreeView resetting cssClasses.
My advice is to catch the dropping event and to notify the user post the action.
the Telerik team
Cant you just do something like this using the asp.net razor syntax?
var dnd = false;
.DataSource(dataSource => dataSource
.Read(read => read
Sorry. I read over/did not grasp that it was per node type.
But Dude! Mind blown! The history is all about the future. Posts live forever dude...so now it's less about you and your most excellent skills and more about the noobs who are just trying to catch this wave now. Scale back and take a chill. We can pay it forward, and we'll all be excellent together.