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.

images

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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.