我有一个多层次的分层布局继承:
Layout.cshtml
MaterialLayout.cshtml // inherits Layout.cshtml
UserPanelLayout.cshtml // inherits MaterialLayout.cshtml
Index.cshtml // inherits UserPanelLayout.cshtml我已经在Layout.cshtml (例如@RenderSection("Loader", false) )中定义了一个节,我想在UserPanelLayout.cshml中定义该节。
但我知道这个错误:
以下部分已经定义,但未被页面呈现为'/Views/Shared/MaterialLayout.cshtml':'Loader‘。若要忽略未呈现的部分,请调用IgnoreSection("sectionName")。
在多级层次布局继承中使用区段的正确方法是什么?
发布于 2018-02-07 08:25:37
要实现这一点,您需要像这样定义MaterialLayout.cshtml中的部分:
@section Loader
{
@RenderSection("Loader", false)
}https://stackoverflow.com/questions/48658875
复制相似问题