OK new to MVC. I had asked this question earlier and got an answer but I am wondering if there is a simpler solution.
Say I have a master page with a menu laid out as an
Just learning MVC now, but I came across this problem and I've figured out a much quicker method of achieving this. It relies on consistent URLs, and isn't affected by query strings.
Of course, you could handle multiple URLs showing the same item selected through OR
logic or making a list. But if you're making a list, you'd of course want that in your model. You could have an option highlight for a whole directory by just checking that the start of the string matches.
As is, this would be most suitable to a more static website. If you include this on a LayoutPage, maintenance is pretty easy as you don't have extra classes or functions to maintain. Obviously this wouldn't cut it if you were working off a CMS.