I have a partial view(strongly typed)a1 defined within my Master Layout view(A). I then have a sub view(B) who itself is a layout view but nested within the Master Layout view. Then I have a page view from which is invoked and loaded with model data. How do I pass data within this data up to the Partial view nested in the Master Layout view please?
Shared/_Layout.cshtml (Master Layout)
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<header>
@RenderPage("~/Views/Shared/PartialViews/Shared/_headerView.cshtml")
</header>
</body>
</html>
Shared/_Layout.cshtml (SubLayout)
@{
ViewBag.Title = "Blog";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@if (IsSectionDefined("BlogHeaderContent"))
{
<div class="blogHeader">
@RenderSection("BlogHeaderContent", required: false)
</div>
}
@RenderBody()
Views/Blogs/blogindex.cshtml (Blog View)
@model MyModels.Blog
@{
ViewBag.Title = " See Blog";
}
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<legend>Blog</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Body)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Body)
@Html.ValidationMessageFor(model => model.Body)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Title)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Title)
@Html.ValidationMessageFor(model => model.Title)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}