The call is ambiguous between the following method or properties in ASP.NET MVC RenderAction
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&quo开发者_开发问答t;); %>
Action Method
public ActionResult ProductItemList()
{
return View("~/Views/Product/ProductItemList.ascx", _repository.GetProductList().ToList());
}
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
}
精彩评论