ASP. NET MVC bootstrap template Select Menu Highlight Current Item method

Source: Internet
Author: User
Tags unique id

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.