I have an action as follows:
public ActionResult ChangeFeeCheck(string id)
{
ViewBag.id = id;
return View();
}
on my View, I have the following:
@{
ViewBag.Title = "CreateList";
}
Please enter first name <br /><br />
@using (Html.BeginForm())
{
@Html.Textbox("firstname")
<input type="button" id="SaveChanges" value="Save" />
}
When I click on the button, I was expecting it to to the following
[HttpPost]
public ActionResult ChangeFeeCheck(string firstname)
{
.....
}
I am not sure when MVC will automatically go to the HttpPost or if I when need to manually have it there. In the above, it does not go there directly. I have to use the
window.location.href
and pass the url of the controller/action.
Meaning, isn't the default for
Html.BeginForm()
The HttpPost(same name as the HttpGet)