Retain treeview state during navigation

  • Thread starter Thread starter Pål Andreassen
  • Start date Start date
P

Pål Andreassen

We are using a TreeView defined in a MasterPage for navigation.
The tree holds it's state turing postbacks just fine since it's using
viewstate. But whenever a node click results in a redirect to a new content
page the tree state is lost and the tree needs to be re-initialized.

Any tips on how to retain the state of the three also during non post-back
or requests (GET requests or Response.Redirect).

Some how I need to store the whole tree (nodes, states and all) to Session
or something similar. But I'm at loss on how.
 
What does "turing navigation" mean?
What does tree Initialization mean?

Thanks
DWS
 
I have just discovered this very same problem 2 hours ago.

The treeview works fine for browsing (expanding / contracting nodes) however
when transfer to a new page occurs the treeview is completely reset to its
original state.

I need it to maintain the users selection of expanded and contracted nodes.

Is this a bug with the treeview control ????
 
What does "turing navigation" mean?
What does tree Initialization mean?

Sorry, that should have been "during navigation".

As for tree initialization I mean the process of figuring out which nodes
should be in the tree. That is dependant on the logged-in users rights, the
context, what applications are installed and so on.
 
I have just discovered this very same problem 2 hours ago.

The treeview works fine for browsing (expanding / contracting nodes)
however when transfer to a new page occurs the treeview is completely
reset to its original state.

I need it to maintain the users selection of expanded and contracted
nodes.

Is this a bug with the treeview control ????

So, this is a consequence of how web controls store state in the VIEWSTATE
during postsbacks. When a navigation occurs (a redirect / normal GET
request) to a "new" page/URL there is no viewstate and hence the tree
looses it's state. Remember that webpages are essentially state-less. What
we are trying is to implement state accross multiple pages, and there
normally where Session (or querystrings) come to the rescue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top