views:

645

answers:

1

I need to setup an image menu. The client wants a specific font and the tabs aren't really CSS-able. That said, I am wondering what the approach is to maintain state on selected menu items?

For example: Lets say I have 5 tabs

--HOME-- --YOUTH-- --ADOLESCENCE-- --ADULT--

When the user clicks on the 'YOUTH' menu item, they are taken to the 'youth.aspx' page which contains blog post summaries relevant to that menu item. On the bottom of the blog post summaries there are links to - "READ MORE >". The read more link takes them to the 'blogpost.aspx' page. How do I keep the 'YOUTH' menu item in a selected state when I go to 'blogpost.aspx' and likewise - how do I keep the other tabs in a selected state when I go to 'blogposts.aspx' from their blog summaries?

ADDED: The framework I am building on has URL rewriting, so I can create routes and generate query string params which are hidden from the user. I'm guessing one such way is to have all the master pages map the querystring param to a 'selected' state in the menu.

I have a few ideas, but I would like to hear suggestions from people that know much more than me.

Thank you.

+1  A: 

You will have to "record" your current state in the masterpage before redirecting to your new page. Then on the masterpage of the new page, reselect your menus, settings etc.

A good place for this type of data is in Session especially since you can clear the information as soon as you use it in your secondary page. You could also pass these settings on the query string but if they are numerous, your query string might get complicated.

You won't be able to do direct navigation from the initial page. Controls such as the HyperLink control won't give you the opportunity to record the current state. The NavigateUrl property on the Menu control is likely to cause similar issues. Instead, wire up the select event on the menu, record and then redirect.

Hope this helps.

-A

Andrew Robinson