InterviewSolution
| 1. |
Explain Sections Is 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{ TEST CONTENT} 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{ } 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) |
|