问题
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());
}
回答1:
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
and POST
, both without and parameters. An easy workaround is to add FormCollection form
as the parameter of POST.
[HttpGet]
public ActionResult ProductItemList()
{
//GET
}
[HttpPost]
public ActionResult ProductItemList(FormCollection form)
{
//POST
}
来源:https://stackoverflow.com/questions/3686906/the-call-is-ambiguous-between-the-following-method-or-properties-in-asp-net-mvc