''Amc'名称在当前上下文中不存在

问题描述 投票:0回答:1
 <div role="tabpanel" class="tab-pane" id="second">
            @Html.RenderAction("Amc", "UserController")
  </div>

我正在尝试在索引中添加部分视图,但是它不起作用。除此之外,它说:“ 名称Amc在当前上下文中不存在”

c# model-view-controller asp.net-mvc-partialview
1个回答
0
投票

抱怨它在当前上下文中不存在,因为(从上面的代码看)它不存在。这不是一个对象。如果要渲染部分,则需要调用渲染它的controller方法。

例如:

@Html.RenderAction("Amc", "UserController") // If Amc is the controller method that renders the partial.

请参见here以获取更多信息

© www.soinside.com 2019 - 2024. All rights reserved.