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.