RenderBody不起作用

时间:2013-07-31 13:38:36

标签: asp.net-mvc-4

我有一个主要的布局,其中@Renderbody可以工作,但我现在正在开发一个新的控制器(称为System),所以我想使用另一个布局。所以我在_ViewStart.cshtml文件夹中添加了~/Views/System。这个页面的内容是:

@{
    Layout = "~/Views/Shared/_System.cshtml";
}

所以我在名为_System.cshtml的共享视图文件夹中创建了一个视图。它似乎确实找到了布局,因为当我删除_System.cshtml时它确实说没有布局。

但为什么会出现这个错误? :\

Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments

Source Error:

Line 11:         <div id="content">
Line 12:             @RenderBody
Line 13:         </div>
Line 14:     </body>

1 个答案:

答案 0 :(得分:4)

RenderBody是一种方法:

@RenderBody()
相关问题