ASP.NET MVC: Masterpage: How to set css class on active menu item

前端 未结 5 1391
情书的邮戳
情书的邮戳 2020-12-23 23:25

I have the following menu in my masterpage:

  • <%= Html.ActionLink(\"Employees\",
5条回答
  •  礼貌的吻别
    2020-12-23 23:52

    This should NOT be done with Javascript! Deciding which page you are on is the job of the server side code, it's not a UI behaviour.

    Have the menu as a user control and pass a value to it to indicate which part of the menu should be highlighted. I'm front end person, not a .NET developer but something like this:

    
    

提交回复
热议问题