<div role="tabpanel" class="tab-pane" id="second">
@Html.RenderAction("Amc", "UserController")
</div>
我正在尝试在索引中添加部分视图,但是它不起作用。除此之外,它说:“ 名称Amc在当前上下文中不存在”
抱怨它在当前上下文中不存在,因为(从上面的代码看)它不存在。这不是一个对象。如果要渲染部分,则需要调用渲染它的controller方法。
例如:
@Html.RenderAction("Amc", "UserController") // If Amc is the controller method that renders the partial.
请参见here以获取更多信息