Activates the current View menu highlight rendering V2.0

Source: Internet
Author: User

Some time ago, Insus.net shared a "Activate Current View menu highlighting" http://www.cnblogs.com/insus/p/5287093.html This is just the same controller menu.

Share one today, with different controllers, presenting a site menu-oriented. Find a website: http://www.engtek.com/services.html, this site in addition to the home page, the other sub-pages have a menu-oriented:

3 tags, it will vary according to the sub-page entered, the tag # # display menu text, Mark # #, navigation menu, Mark # # is a background image.

In general, when you design this part of the site, you put this code, copy and edit text and background images on each sub-page.

< Sectionclass= "Main-contents dot-overlay engtek-bg8 Parallax"Data-stellar-background-ratio= "0.6">   <Divclass= "Container">     <Divclass= "Section-title section-title-style7 padding-top30">       <h4class= "Red-color">Services</h4>       <Divclass= "Breadcrumbs-container">                    <Divclass= "Container">                        <ulclass= "breadcrumb">                            <Li><ahref= "Index.html">Home</a></Li>                            <Li><ahref= "services.html">Services</a></Li>                            <Liclass= "Active">New Product Introduction</Li>                        </ul>                    </Div>                </Div>     </Div>   </Div> </ Section> 

The following highlights are part of the change:


Or a better approach, the view under each controller is made into a partial view.

But above, are not what insus.net want to need. Insus.net's approach is simply to use a partial view of the entire station. If this is done, you need to know which controller and which view is currently requested.
No matter, this already knows: "Get current View name" http://www.cnblogs.com/insus/p/5283729.html.

In fact, this is not a problem, the problem is that after knowing the controller and the view name, people have to be based on the controller name to get all the views under the controller (that is, submenus).

To solve this problem, Insus.net uses the technology of interface, reflection and so on:

Below is the interface, according to your actual situation, the use of properties, methods, etc.:



This interface is then implemented in each controller or controller entity:



Finally, some views can be written like this:


Activates the current View menu highlight rendering V2.0

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.