Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

AP.net Menu on Masterpage looses hi-lite when linked to new page.

Posted on 2009-04-10
5
Medium Priority
?
314 Views
Last Modified: 2013-11-05
Hi, how do I "keep" which menu item is selected.

My menu is on the masterpage, and whenever i navigate to a content page, the menu items "selected backcolor" (you know what I mean) does not get applied.

I reckon its because the masterpage does not know where it is, cause its still only on itself... how do I have the content page tell the masterpage where we are now?
0
Comment
Question by:FadeDude
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Buginator
ID: 24114547
Have you tried to enable Viewstate for the dropdown menu?
0
 

Author Comment

by:FadeDude
ID: 24114694
hmm, no, but i am not neccecarily using dropdown menus...

When there is just one page, lets say default.aspx, the menu on the masterpage works as desired.. when clicking on a menu option, a postback occurs and that menu option show a diffrent back color.... showing that it is the current selection.

When i start linking to other pages (adding pages to the project, and it redirects to a page outsite of where it was loaded, i loose the "selected" look.
0
 
LVL 5

Accepted Solution

by:
Buginator earned 500 total points
ID: 24114720
I see. On the postback event that occurs after clicking on a menu item, create a session that contains some info about the selected menu item, the ID for instance. Then in each page load event (when a page get's loaded) check if the session exists, and if so, get the ID. Then find the appropiate menu item by comparing the session ID and the menu ID's, and manually select the menu item that corresponds with the session ID.
0
 

Author Comment

by:FadeDude
ID: 24114773
thanks, i was also thinking maybe using a url variable methog..?

Post to 2ndpage.aspx?page=2ndpage

and then catching that in the masterpage load event...

Will give it a try. Thanks
0
 
LVL 5

Expert Comment

by:Buginator
ID: 24114824
Yes of course, you could do that, but the url will then become slightly messy. You also have to remember everytime you create hyperlinks that you include the correct querystring value so that you highlight the correct menu item. If you ask me, this would be quite cumbersome. That's why I think sessions is the best alternative of those two, as you don't need to hardcode url's, but instead only use one simple function that you use all the time on all the different pages. This solution could very easily be a enormous time saver if you later on need to change the page structure since you only need to alter this single function that affect the whole site, instead of changing every hyperlink on every page. Good luck either way!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question