Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with treeview node state management.

0 views
Skip to first unread message

brian richards

unread,
Jun 4, 2003, 1:11:22 PM6/4/03
to
I'm trying to figure out away to save the expand/collapse states of all the
child nodes in a TreeView across multiple pages. Basically we have a basic
menu on the left side of the page when they navigate to a node that links
them to another page with the same menu stucture, it resets the menu to it's
default state (ie everything is collapsed). I'd like to keep open what the
user opened. I'm thinking maybe I can do this by overriding the
onselectedindexchange method and some how save the expanded properties of
all the nodes in the tree. My other thought is to maybe use multipage views
but that won't always be appropriate. Also I think I could pretty easily
hack out something akin to a bread crumb trail for each of the sub pages,
but I'd like to just save whatever the menu state is for the user and
persist that over all pages. I was using lightweight javascript/css before
but I had the same issue with state management. One other thought is that
When you set autopostback to true it sends everything back to the
originating page, and keeps everything open. Could I maybe use a postback
to process the click then use Sever.redirect(url)? I've been doing alot of
brain storming I just can't seem to come up with anything that works.


Thanks

Brian


Adrian Parker

unread,
Jun 4, 2003, 2:51:32 PM6/4/03
to
Don't know if you can do this but..

If you know the state of each of the nodes in the tree, can't you generate a binary string saying if each is expanded / collapsed
and store it in the session, then on page load, traverse the tree and programatically expand the required ones ?

-Adrian

"brian richards" <brian...@hotmail.com> wrote in message news:uEkdYwrK...@TK2MSFTNGP09.phx.gbl...

brian richards

unread,
Jun 4, 2003, 2:08:09 PM6/4/03
to
Sounds like an interesting idea. But at what point should I generate the
string? Basically I need to do it when the user is going to another page (ie
clicks on a node with target url). I need to capture the state of the menu
and crame it into the session BEFORE forwarding them to the next page. I
don't really know how to do that except maybe with some javascript, but it's
gotta be on the server side session. Hmm maybe a cookie....
-Brian

"Adrian Parker" <m...@nospam.com> wrote in message
news:<e0yECHs...@TK2MSFTNGP12.phx.gbl>...

Adrian Parker

unread,
Jun 4, 2003, 3:32:12 PM6/4/03
to
because the page redirect is clientside (I think), you'd need to see if there was an event generated on the treeview when a node is
expanded or collapsed.. then build your string there.

-Adrian

"brian richards" <brian...@hotmail.com> wrote in message news:OVt2GQsK...@TK2MSFTNGP09.phx.gbl...

Adrian Parker

unread,
Jun 4, 2003, 3:35:52 PM6/4/03
to
yep, just looked and there are events for expand and collapse on a treeview, so do it there. You can use node.expanded = true/false
to open and clsoe them.

-Adrian


0 new messages