I am using LoadOnDemand from a web service to populate a treeview. I am trying to provide functionality so the user can right-click a node and get a context menu to choose Add, Copy, Cut and Delete functionality to edit the tree. In a previous thread:
http://www.telerik.com/community/forums/aspnet-ajax/treeview/how-to-refresh-tree-when-node-is-added-using-webservice-method.aspx
Veronica was kind enough to point me to the technique of collapsing a node, clearing its children, setting its expand mode like this "Telerik.Web.UI.TreeNodeExpandMode.WebService", and then committing the change.
That is great. But, what event can I key on to run this code? All the events provided in the client side API happen BEFORE the edits are made (before the trip to the database) so, how can I wait until AFTER the node is pasted, deleted, or added (after the changes to the database) and THEN update the treeview to reflect the change.
I have been searching the documentation but, I haven't found any way of capturing the return from the server.
Thanks for whatever advice you can offer.
UPDATE: After further research...should I do my operation in reverse? Should I do all the edits on the client side (in the OnClientContextMenuItemClicked event, etc) and then have the server use the ClientOperations property to handle the edits that have just been made, and update the database? For some reason I feel more comfortable editing the database and then making sure the treeview in the browser updates to reflect the changes, in stead of visa versa but, I guess it is all the same in the end. [what if the database update fails for some reason? Then the client will be out of synch with the data.]
http://www.telerik.com/community/forums/aspnet-ajax/treeview/how-to-refresh-tree-when-node-is-added-using-webservice-method.aspx
Veronica was kind enough to point me to the technique of collapsing a node, clearing its children, setting its expand mode like this "Telerik.Web.UI.TreeNodeExpandMode.WebService", and then committing the change.
That is great. But, what event can I key on to run this code? All the events provided in the client side API happen BEFORE the edits are made (before the trip to the database) so, how can I wait until AFTER the node is pasted, deleted, or added (after the changes to the database) and THEN update the treeview to reflect the change.
I have been searching the documentation but, I haven't found any way of capturing the return from the server.
Thanks for whatever advice you can offer.
UPDATE: After further research...should I do my operation in reverse? Should I do all the edits on the client side (in the OnClientContextMenuItemClicked event, etc) and then have the server use the ClientOperations property to handle the edits that have just been made, and update the database? For some reason I feel more comfortable editing the database and then making sure the treeview in the browser updates to reflect the changes, in stead of visa versa but, I guess it is all the same in the end. [what if the database update fails for some reason? Then the client will be out of synch with the data.]