【发布时间】:2011-10-24 13:31:44
【问题描述】:
我正在尝试从我的自定义区域呈现在 _layout 文件中定义的部分。
在我所在的区域,我有 _ViewStart,它指向根站点中的 _layout。
我尝试使用的部分在 head 标签中,但在我的区域中,它放在 body 中。
在根级别呈现的页面可以正常工作。
~/Views/Shared/_Layout.cshtml
<head>
@RenderSection("header", true)
</head>
<body>
....
</body>
~/Areas/UserMedia/Views/_ViewStart.cshtml
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
~/Areas/UserMedia/Views/ManageProjectMedia.cshtml
@{
ViewBag.Title = "ManageProjectMedia";
}
@section header{
{
<!-- scripts and styles -->
}
<div>
... page content
</div>
【问题讨论】:
-
你能提供的任何代码都很好。
标签: asp.net-mvc-3 asp.net-mvc-3-areas