ASP.NET MVC RenderAction 中的以下方法或属性之间的调用不明确
在我安装 ASP.NET MVC 1.0 RTM 之前,该调用工作正常。
错误:CS0121:以下方法或属性之间的调用不明确
代码片段
<%Html.RenderAction("ProductItemList", "Product"); %>
操作方法
public ActionResult ProductItemList()
{
return View("~/Views/Product/ProductItemList.ascx", _repository.GetProductList().ToList());
}
The call was working fine until I installed ASP.NET MVC 1.0 RTM.
Error: CS0121: The call is ambiguous between the following methods or properties
code snippet
<%Html.RenderAction("ProductItemList", "Product"); %>
Action Method
public ActionResult ProductItemList()
{
return View("~/Views/Product/ProductItemList.ascx", _repository.GetProductList().ToList());
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您有两个具有相同签名的操作方法,并且 RenderAction 无法决定使用哪一个。你需要以某种方式使行动变得独特。
当存在
GET
和POST
的操作(不带参数)时,我通常会看到这种情况。一个简单的解决方法是添加FormCollection form
作为 POST 的参数。You have two action methods with the same signature, and the
RenderAction
cannot decide which to use. You need to somehow make the actions unique.I usually see this when there is a Action for a
GET
andPOST
, both without and parameters. An easy workaround is to addFormCollection form
as the parameter of POST.