Wednesday, January 4, 2017

Part 23 - RenderBody, RenderSection and RenderPage in Asp.Net MVC Application



RenderBody
o   RenderBody method exists in the Layout page to render child page/view. It is just like the ContentPlaceHolder in master page.
o   A layout page can have only one RenderBody method
o   @RenderBody()

RenderSection
o   A section allow you to specify a region of content within a layout.
o   Example:
    @section MySection{
                    <h2>Welcome to Technotips mvc</h2>
                   }
o   You can render above defined section header on the layout page as given below:
o   @RenderSection(" MySection”,required: false)

RenderPage
o   RenderPage method also exists in the Layout page to render other page exists in your application. A layout page can have multiple RenderPage method.
o   @RenderPage("~/Views/Shared/_MyPage.cshtml")



All Code Factory

1 comment:

Unknown said...

sao k cho cái code xem