O'Reilly logo

Applied ASP.NET 4 in Context by Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required