When we handle the background to display the current page, the current page menu item highlighting, we can use the JS method, also use the program implementation, using the bootstrap template processing one of the highlighting and expansion method
1. Import in Project
<src= "/assets/admin/layout/scripts/layout.js"></Script >
2. Add a unique ID to the subproject item and click the current page to transfer the current unique ID to the controller.
<a href="@item2. Linkurl[email protected] " id="@item2. Id" > <iclass="icon-settings"></i>@item2. Name @if (list. Where (d= = D.parentid = = item2. ID). Count () >0) {<spanclass="Arrow"></span>} </a>
3. The ID of the incoming highlight in the controller that needs to be highlighted on the main page
Public ActionResult List (string= ID. ToLower (); return View ();}
4. Set JS highlighting in the page
@section footer{ <script> jQuery (document). Ready (function () { Layout.setsidebarmenuactivelink ( ' Set ', $ (' # @ViewBag. CLASSID '); }); </script>}
5. Allow the project, click the current item program to automatically add the expanded and highlighted style.
ASP. NET MVC bootstrap template Select Menu Highlight Current Item method