layout_quiz.md - brainchildservices/curriculum GitHub Wiki

  1. Describe Layout ?

    Most web apps have a common layout that provides the user with a consistent experience as they navigate from page to page. The layout typically includes common user interface elements such as the app header, navigation or menu elements, and footer. Common HTML structures such as scripts and stylesheets are also frequently used by many pages within an app. All of these shared elements may be defined in a layout file, which can then be referenced by any view used within the app. Layouts reduce duplicate code in views.

  2. What is RenderSection ?

    The layout have only contain one RenderBody method, but can have multiple sections. RenderSection method is used to create sections in layout. RenderSection runs code blocks which we define in our content pages.

  3. What is the default layout for an ASP.NET Core app ?

    _Layout.cshtml

  4. How to Specifying a Layout ?

    @{ Layout = "_Layout"; }

  5. Uses of layout ?

    In ASP.NET Web Pages, you can define a layout page that provides an overall container for pages on your site. For example, the layout page can contain the header, navigation area, and footer.

  6. What is @RENDERBODY ?

    @RenderBody is used for injecting content from child page into the master page design. If there is no named section in child page, the content will get displayed in RenderBody section.

    Eg :- < div class="content"> @RenderBody() < /div >

  7. What is @RENDERSECTION ?

    @RenderSection is used for injecting content in the defined section. It allows you to specify a region in Layout.