Problem:
Given this nested layout structure:
~/Views/Shared/_layoutBase.cshtml ~/Views/Shared/_layout.cshtml
Where _layoutBase.cshtml
is the layout for _layout.cshtml
.
Any sections defined in the layout files render their content fine in pages under ~/Views/...
However, for views in an area, the sections are never rendered.
Setup:
_layoutBase
:
<script type="text/javascript">
@RenderSection("footerScripts", false)
</script>
</body>
</html>
_layout.cshtml
:
@section footerScripts{
@RenderSection("footerScripts", false)
}
"content" view:
@section footerScripts{
$(function () {
SetFocusOnForm("CaptchaCode", "NextButton");
});
}
The content of section footerScripts
never gets rendered in a view in an area. It does get rendered in a view that is under the ~/Views
folder.
Area _ViewStart.cshtml
:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
Question:
Can you see anything wrong?!