asp.net mvc 4 - How to get current controller name with jquery? -
i want active menu item in mvc jquery.
<ul id="menunav" class="nav nav-pills"> <li> <a href="/reportgenerator/index">reports</a> </li> <li> <a href="/account/roles">user groups</a> </li> <li> <a href="/projectstatedefinition/index">projects</a> </li> </ul>
i created menu @html.navigation()
.
i want current controller in jquery add active class selected menu.
highlightactivemenuitem = function () { var currentaction = ???; var currentcontroller = ???; };
try
<script type="text/javascript"> function currntcontrol(){ alert('@httpcontext.current.request.requestcontext.routedata.values["controller"].tostring()'); } </script> <button onclick="currntcontrol()"></button>
Comments
Post a Comment