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

Source: Internet
Author: User
Tags unique id

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="@[email protected]" id="@item2. Idclass="icon-settings" ></i>0class="" "></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) {VIEWBAG.CLASSID = 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. Bootstrap template selected menu highlighting 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.