MVC series Learning (7)-template page, mvc series learning templates

Source: Internet
Author: User

MVC series Learning (7)-template page, mvc series learning templates

1. Create an MVC project and select basic

1. In/Views/_ ViewStart. cshtml [if this subview exists in/Views, load it at runtime, and it has a higher priority than other Views]

2. On the/Views/Shared/_ Layout. cshtml [template page or Layout page, if Layout = null is not set in the view, the Layout page is called by default]

3. In/Views/Home/_ ViewStart. cshtml [after loading/Views, _ ViewStart. cshtml,

The system then traverses whether there is a view named _ ViewStart. cshtml in the folder where the current request view is located. If yes, the system loads the view]

4. In/Views/Home/SonPage. cshtml [view of this learning]

1. When requesting the SonPage. cshtml view page,
2. First, the compiler loads the View named _ ViewStar. cshtml under the View folder (the View takes precedence over all views and can have one under any folder)
3. If the Layout attribute in _ ViewStart. cshtml is not null, the Layout page is loaded, and the corresponding Layout page is loaded based on the value of Layout,
3.1 In the layout page, you can specify different locations on the page to display different webpage content
4. Then, in the folder where the view (SonPage. cshtml) is located, check whether the file named _ ViewStar. cshtml is ready for loading,
5. Finally, the request view (SonPage. cshtml) is loaded)
6. if the template page contains a "trap", fill in the trap in the corresponding position of the template page (if not required, you can leave it blank), and then SonPage. other content in cshtml is filled in the big pitfall.

Related Article

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.