This section demonstrates how to use the template page in MVC3, in the traditional WebForm design pattern, we use masterpage as the template page, and in the MVC3 Razor view design, we use a different approach as the template page.
Create a new MVC3 project, in solution resource management, we can see a shared folder underneath the Views folder. There is a _layout.cshtml page in the shared folder. This is the default template page in the project. such as 1. New content pages content pages are also called view layout pages in MVC3. You can right-select the View folder, add a view to add a content page, and then select the appropriate template. Here is the content page we created viewpageone.cshtml The page that uses the template page will automatically generate code in the page. To specify a template page, use layout to specify a specific template page. If there is no layout property in the content page, the default template page is used [html]@{ viewbag.title = "Viewpageone"; Layout = "~/views/shared/_layout.cshtml"; }
ASP MVC3 Chewing---(2) template page