如何使用ServiceStack.Razor嵌套布局?

时间:2013-06-10 23:51:15

标签: razor servicestack

给出以下目录结构(为了简单起见):

/
  _Layout.cshtml
  _SubLayout.cshtml
  default.cshtml
  sub.cshtml

内容:

sub.cshtml

@inherits ServiceStack.Razor.ViewPage
@{Layout = "_SubLayout";}
<div>In the sub folder.</div>

_SubLayout.cshtml

@inherits ServiceStack.Razor.ViewPage
@{Layout = "_Layout";}
<div>This is a page from a sub section:</div>
@RenderBody()

如何在为sub.cshtml发出请求时在_Layout.cshtml视图中呈现_SubLayout.cshtml视图?当我这样做时,现在只使用_SubLayout.cshtml。

1 个答案:

答案 0 :(得分:2)

ServiceStack 3.9.54支持此功能