It’s a simple question. How did stackoverflow do their menu in Asp.net MVC, with highlight on what page we are on.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For the purpose of this, i’ve writen some code down, there are some part that using my custom extension like Language, go ahead and use it, just ignore the minor part.
This one i place on top of my Partial that contain the menu to get the action and controller, so that i can pass this to the extension.
This is the sidebar Item, basically this will generate a “li” tag with a link and your custom class to indicate whether the link is currently used in the page / highlight.
and here is the actual usage of the code above