Working with Layouts

When we created the List.cshtml view, we checked the option to use a layout. You can see the option from the Add View dialog in Figure 25-10. Layouts are the Razor equivalent to the master pages you saw in Chapter 9. They serve the same purpose as master pages but work in a slightly different way.


Figure 25-10. Setting the layout options when creating a view

We checked the option to use a layout, but we didn't specify one. If we look underneath the text box in the figure, we will see that it says “(Leave empty if it is set in a Razor _viewstart file),” and if we open the ~/Views/_ViewStart.cshtml file, we can see what ...

Get Applied ASP.NET 4 in Context now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.