| 1. |
Explain Sections Is Asp.net Mvc? |
|
Answer» Section are the part of HTML which is to be RENDERED in layout page. In Layout page we will use the below syntax for rendering the HTML : @RENDERSECTION("TestSection") And in child pages we are defining these sections as shown below : @section TestSection{ <h1>Test Content<h1> } If any child page does not have this section DEFINED then error will be thrown so to avoid that we can render the HTML like this : @RenderSection("TestSection", REQUIRED: false) Section are the part of HTML which is to be rendered in layout page. In Layout page we will use the below syntax for rendering the HTML : @RenderSection("TestSection") And in child pages we are defining these sections as shown below : @section TestSection{ <h1>Test Content<h1> } If any child page does not have this section defined then error will be thrown so to avoid that we can render the HTML like this : @RenderSection("TestSection", required: false) |
|