I have 2 WebDataTrees and I'm trying to move a node from one tree to another tree. When I start dragging the node to another tree I have written some validation logic in nodeDropping event on clientside and I want to update the change in database by making an async call(ex: using PageMethods.UpdateData method). But without the record getting updated in database the source_node is being added under dest_node.
How can I accomplish my task of adding the record in the database in nodeDropping event. If the update into the database is successful, then I want to add the source_node to dest_node. Otherwise, I don't want to add the source_node to the dest_node of other tree and put the source_node where it belongs by calling args.set_cancel(true).
Hello Naveen,
When you try to drop a node from one of the trees to the other the server side event nodeDropped will be fired. You will have to use the AutoPostBackFlags-NodeDropped property and set it On.
Then In the nodeDropped event I will suggest you use dataBind to bind the data source again. That way if the item that is drooped is added to the data source, you will update the source of the tree. And if the node doesn’t fit your criterion, you will just data bind the tree to the old data source.
Same goes for the second tree. On every attempt to drag a node and drop it to the first tree, you should check whether the node will update the first tree’s data source and if it doesn’t so, you should data bind the second tree again to its data source.
If you have questions let me know.
Thanks for the suggestion.
But I don't want to do a postback and reload the entire page.. Our users main complain is that is take long time to load the tree when they do any the update on the tree. So can you please suggest an alternative approach doing this on the client side without postback