Razor, Nested Layouts and Redefined Sections

In a recent post I introduced a technique for dealing with optional Razor sections and default content. In this post I will expand upon that technique and describe a way of working with sections across nested layout hierarchies. If you are not familiar with sections, layout pages, or my technique then go ahead and read…

10

Optional Razor Sections with Default Content

Solution quick links: IsSectionDefined method Razor inline templates RenderSection The new ASP.NET page framework built on Razor (which is available in MVC 3) provides a facility for content pages to contribute named fragments of markup to their layout pages which the layout page can then render in an arbitrary location using the RenderSection method. For…

8