我有一个剃须刀母版页 (_Layout.cshtml),我在其中布局了一个 3 列网站。在其中一个侧栏中,我想显示“登录控件”
根据我的阅读,我可以使用 Html.RenderAction 来调用我的 LoginController,它会在侧栏中显示登录视图。
但是,当我运行它并将其指向控制器/视图以填充 RenderBody() 时,对 Html.RenderAction("Index", "LoginController") 的调用失败并出现此错误。
"The controller for path '/[insert path to a Controller/View to fill the
RenderBody()]' was not found or does not implement IController. "
那么,我做错了什么?
我的代码真的很简单:
<div id="Navigation">@{ Html.RenderPartial("Test"); }</div>
<div id="Main">@RenderBody()</div>
<div id="Misc">@{ Html.RenderAction("Index", "LoginController");}</div>
在我的控制器文件夹中,我有 RenderBody 和 LoginController 的控制器。