Articles : Page 1 of 1

  • Defining Default Content For A Razor Layout Section

    Defining Default Content For A Razor Layout Section

    Mar 11
    05

    Layouts in Razor serve the same purpose as Master Pages do in Web Forms. They allow you to specify a layout for your site and carve out some placeholder sections for your views to implement. For example, here’s a simple layout with a main body section and a footer section. <!DOCTYPE html> <html> <head><title>Sample Layout</head> <body> <div>@RenderBody()</div> <footer>@RenderSection("Footer")</footer> </body> </html> In order to use this layout, your view might look like. @{ Layout ...



  • 1