How should you complete the relevant Razor markup?

HOTSPOT
You develop an ASP.NET MVC application. You are creating a new layout page by using the Razor view
engine.
The layout page has the following requirements:
Render the content of a section named scripts at the bottom of the layout page.
Render the content of a section named featured just above the body of the page.
Render a StyleBundle named ~/Content/css.
You need to implement the layout page.
How should you complete the relevant Razor markup? To answer, select the appropriate Razor markup from
each list in the answer area.
Hot Area:

HOTSPOT
You develop an ASP.NET MVC application. You are creating a new layout page by using the Razor view
engine.
The layout page has the following requirements:
Render the content of a section named scripts at the bottom of the layout page.
Render the content of a section named featured just above the body of the page.
Render a StyleBundle named ~/Content/css.
You need to implement the layout page.
How should you complete the relevant Razor markup? To answer, select the appropriate Razor markup from
each list in the answer area.
Hot Area:

Answer:

Explanation:
Box 1: @Styles.Render(“~/Content/css”)
– Render a StyleBundle named ~/Content/css.
@Styles.Render(“~/Content/css”) iscalling the files included in that particular bundle which is declared inside
the BundleConfig class in the App_Start folder.
Box 2: @RenderSection(“featured”, true)
– Render the content of a section named featured just above the body of the page.
RenderSection renders only a part child view that is wrapped under named section.
RenderSection() method includes boolean parameter “required” which makes the section optional or
mandatory. If required parameter is true then the child view must contain the section.
Box 3: @RenderSection(“scripts”, false)
– Render the content of a section named scripts at the bottom of the layout page.

http://stackoverflow.com/questions/12028401/styles-render-in-mvc4
http://www.tutorialsteacher.com/articles/difference-between-renderbody-and-rendersection-mvc



Leave a Reply 0

Your email address will not be published. Required fields are marked *