The context was that I was not able to find where header/footer were coming from on the HA Flight Results. Turned out that that MVC has this concept of Dont'-Repeat-Yourself layout where you can specify an out wrapper view that would pull in other views and such.
Razor views support now defaults that are applied to all views in ASP.NET MVC web application. Default can be applied by special file so you have one place where everything common is defined.
D:\TFS\HA\Web\Applications\HA.Web.Main\Areas\Book\Views\_ViewStart.cshtml:
@{
Layout = "~/Areas/Book/Views/Shared/_Layout.cshtml";
}
And then in the _Layout:
@Html.Action("GetHeader", "Header", new { Area = "Shared", areaName = "Book" })
<section role="main" class="floral-bg-pattern">
@RenderBody()
</section>
@Html.Action("GetFooter", "Footer", new { Area = "Shared" })
No comments:
Post a Comment