Last post May 15, 2007 04:42 PM by kckriegs
May 09, 2007 02:29 AM|luckymaheshwari|LINK
I am using a Tree View (IE web control)
When the page loads again tree is loaded agian but the state is lost.
I need that nodes which are expanded should remain expanded and nodes which are collapsed should be seen as collapsed.
Whats the way to do this.
May 15, 2007 04:42 PM|kckriegs|LINK
I don't think there is an out-of-the-box way to maintain the TV state across page requests.
You would have to leverage ViewState or session variables.
You may have to extend and customize the TreeView class so that each node has a unique identifier, then save an associated key/value pair for each node (id/expanded [true/false]). Finally, when loading the page, recurse through all nodes, setting the
.Expanded value appropriately.
Seems like a lot of work. Have you thought about using Frames/IFrames? You can set the TreeView's .Target to a Frame/IFrame, leaving the TreeView's Frame alone and its state intact. Use the target frame to do whatever processing/displaying
you wish to do.