The Alert
view that is rendered contains the layout
@model myModel
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
While using an action filter like so
public class CheckThisAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.Result = new ViewResult
{
ViewName = "Alert",
ViewData = new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelBinding.ModelStateDictionary())
{
Model = new myModel()
}
};
base.OnActionExecuting(filterContext);
}
}
the
Should i change _Layout
is not reendered at all. (Only the view is rendered)
Why is this so?ViewResult
to something else, or
include also the _Layout
in the action filter somehow?
Update: After inspecting the rendered page, i noticed that the page contains all info, including the _Layout, but chrome denies to render it
Update: The Layout contains other partial views
<div class="page-wrapper">
<div class="page-inner">
<partial name="_LeftPanel" />
<div class="page-content-wrapper">
<partial name="_PageHeader" />
<main id="js-page-content" role="main" class="page-content">
@RenderBody()
</main>
<partial name="_PageContentOverlay" />
<partial name="_PageFooter" />
</div>
</div>
</div>
which do not seem to load at all, and that is the reason why the output is only
<div class="page-wrapper">
<div class="page-inner">
<div class="page-content-wrapper">
<main id="js-page-content" role="main" class="page-content">
<div class="alert alert-warning" role="alert">
<strong>Alert!</strong> This is what only is displayed
</div>
</main>
<div class="page-content-overlay" data-action="toggle" data-class="mobile-nav-on"></div>
</div>
</div>
</div>