how do i call an overloaded action in .net mvc?
Posted
by Jeff Martin
on Stack Overflow
See other posts from Stack Overflow
or by Jeff Martin
Published on 2010-04-03T16:46:56Z
Indexed on
2010/04/03
16:53 UTC
Read the original article
Hit count: 413
I have an overloaded action in my Controller:
public ActionResult AssignList(int id)
{
...
}
[AcceptVerbs((HttpVerbs.Get))]
public ActionResult AssignList(int id, bool altList)
{
...
}
I'd like to use the same partial view for both lists but it will potentially have a differently filtered list of Images.
I am trying to call it from another view using RenderAction:
<% Html.RenderAction("AssignList", "Image", new { id = Model.PotholeId, altList = true }); %>
However I am getting the following error:
The current request for action 'AssignList' on controller type 'ImageController' is ambiguous between the following action methods:
System.Web.Mvc.ActionResult AssignList(Int32) on type UsiWeb.Controllers.ImageController
System.Web.Mvc.ActionResult AssignList(Int32, Boolean) on type UsiWeb.Controllers.ImageController
How can I call the specific overload?
© Stack Overflow or respective owner