Home - Forums-.NET - FlyTreeView (ASP.NET) - Finding which tree is in focus

FlyTreeView (ASP.NET)

Technical support and KB related to the FlyTreeView control

This forum related to following products: FlyTreeView for ASP.NET

Finding which tree is in focus
Link Posted: 18-May-2007 10:49
I have 3 treeviews on a form. When the form postback, is there an easy way for me to find out which tree is in focus. I have the same contextmenu on each tree and depending on which tree the user right clicks on I'll do a different processing.

Also I have another problem regarding the setting of the attribute value. In my program, I set the value of the Attribute of a node on the client side and I can see the value on the server side. However, after I've processed the information on the server side and try to reset the attribute value of that node, it didn' really update the info on the client side. When the next time the page postback, I see the same old attribute value on that node again. Do I have to force an update on the page after I finish the processing on the server side? If so, how do I force an update? Is there a method I can call?
Link Posted: 18-May-2007 20:17
[quote="mojojojo"]I have 3 treeviews on a form. When the form postback, is there an easy way for me to find out which tree is in focus. I have the same contextmenu on each tree and depending on which tree the user right clicks on I'll do a different processing.

Every context menu click event has an event argument which contains ID of the node associated with the event. So you just need to call flytreeview.FindByID(e.commandArgument) for all three treeview to find where the FundByID returns non null value.

[quote="mojojojo"]
Also I have another problem regarding the setting of the attribute value. In my program, I set the value of the Attribute of a node on the client side and I can see the value on the server side. However, after I've processed the information on the server side and try to reset the attribute value of that node, it didn' really update the info on the client side. When the next time the page postback, I see the same old attribute value on that node again. Do I have to force an update on the page after I finish the processing on the server side? If so, how do I force an update? Is there a method I can call?

Do you update node Attribute at callback (or using PopulateOnDemand)?
Callback changes (including control values changes) does not affect treeview at all. You can use PopulateOnDemand callback only to add nodes and set these nodes properties. All other changes to treeview properties and hierarchy are not transfered to client side (for callback case).
Link Posted: 08-Jun-2007 10:54
Is there a way such that you can update the appeareance of the tree (like adding a node) from the server side to the client side without using PopulateOnDemand.
  For instance, if the user right click on the context menu and click on 'add a new directory', the program will pass the info back to the server side so that it can do the actual creation of the directory. When there is no error then the program will update the trr node and hopefully shows it on the client side. I've tried a few things (like calling node.add, expanded from the server side, but the client side just won't refresh and show the newly created directory).

Is there a command such that it will sync the tree from the server side and the client side (from the server side)?
Link Posted: 09-Jun-2007 00:10
The core thing is that even if you can pass callback to context menu handler, then treeview cannot update its nodes without its own callback (to call populateondemand).

I believe the proper way in this case is to use ASP.NET AJAX framework and put contextmenu and treeview into UpdatePanel control.