ASP. net mvc Bootstrap template selects the menu to highlight the current method, mvcbootstrap
When the current page is displayed in the background and the menu item of the current page is highlighted, we can use the js method or program implementation, and use the Bootstrap template to process highlight and expand one of the methods.
1. import data in the project
<script src="/assets/admin/layout/scripts/layout.js"></script>
2. Add a unique ID for the sub-project, and click the current page to send the current unique ID to the Controller.
<a href="@item2.LinkUrl?id=@item2.Id" id="@item2.Id"> <i class="icon-settings"></i> @item2.Name @if (list.Where(d => d.ParentId == item2.Id).Count() > 0) {<span class="arrow "></span>} </a>
3. input the highlighted item id in the Controller that needs to be highlighted on the home page.
public ActionResult List(string id){ ViewBag.CLASSID = id.ToLower(); return View();}
4. Set JS highlighting on the page
@section footer{ <script> jQuery(document).ready(function () { Layout.setSidebarMenuActiveLink('set', $('#@ViewBag.CLASSID')); }); </script>}
5. Allow the project. Click the current program to automatically add the expanded and highlighted style.