I have an HTML form built using Html.BeginForm(). I specify my controller name and action name, however it does not go to the correct action.
Here is the relevant line from my view:
@using (Html.BeginForm("AdminPanelResult", "AdminPanel", FormMethod.Post))
In my controller I have two methods. No matter what I do it always goes to AdminPanel() and not AdminPanelResult().
Here is what AdminPanel looks like:
public ActionResult AdminPanel() {...}
And this is AdminPanelResult():
[System.Web.Http.HttpPost]
public ActionResult AdminPanelResult(ContentModel model) {...}
My question, how do I get Html.BeginForm to actually use the correct action?
EDIT: As requested here is the rest of my view's form:
<legend>Admin Panel Access</legend>
@using (Html.BeginForm("AdminPanelResult", "AdminPanel", FormMethod.Post))
{
<fieldset>
<div id="AdminPanelResult"></div>
<ol>
<label for="selOrgName">Choose an Organization Name:</label>
<select name="selOrgName" id="selOrgName">
<option id="0">Select an Org Name</option>
@foreach (var r in data.glOrgName)
{
<option id="@r.OrgKey" value="@r.OrgName">@r.OrgName</option>
}
</select>
<label for="apiDrop">Choose the type of Data:</label>
@Html.DropDownList("ApiId", (MultiSelectList)ViewBag.Categories, new { multiple = "multiple" })
<li>
@Html.Label("...")
@Html.TextBox("..")
</li>
<!--Several more identical elements removed for brevity-->
</ol>
<p>
<input type="submit" value="Submit" />
</p>
</fieldset>
}