The current Create action request for the WeeklyTargetController controller type is ambiguous between the following action methods:

I saw this problem a lot here, but my problem is a little different. I already have two Create actions that were created by MVC out of the box, listed as such (one GET, one POST):

public ActionResult Create()
{
//stuff...
}

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include="WeeklyTargetId,UserId,WeekId,Hours")] WeeklyTarget weeklytarget)
{
//stuff...
}

My problem is that I am trying to update the Create View based on DropDown, which was added to the page enclosed inside its own form, where when presented, the user can filter another drop-down menu in the main Create form. Here is my separate wrapped form in the Create view:

@using (Html.BeginForm())
{
<p>        
    <span>
        Filter By Practice:
        @Html.DropDownList("Practice", (List<SelectListItem>) ViewBag.PracticeList, new { @onchange = "this.form.submit();"})
    </span>

</p>
}

, , , onchange Create, :

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(FormCollection formCollection)
{
//do the filtering stuff...
}

, , MVC , , Create. ? ? , Create? , Create View, . , !

+3
1

BeginForm .

Html.BeginForm("FilterAction", "ControllerName")

, SelectList, ViewBag.

:

FormExtensions.BeginForm

+2

All Articles