I have a simple form on the browse page implemented as a user control that looks something like this:
<%=Html.BeginForm("List", "Building", FormMethod.Post) %>
<%Html.EndForm(); %>
There are two problems that I would like to solve, firstly, I would like the controller method to get this in order to accept a parameter like a user control. The goal is not to put all the form fields in the parameter list for the method. Now the controller method is as follows:
[AcceptVerbs("Post")]
public ActionResult List(string capacityAmount)
{
ProfilerDataDataContext context = new ProfilerDataDataContext();
IEnumerable<Building> result = context.Buildings.OrderBy(p => p.SchoolName);
ViewData["Boroughs"] = new SelectList(Boroughs.BoroughsDropDown());
return View(result);
}
The remaining fields in the form will be used to search by type of building.
The message form is excellent, I can search for capacity as you would expect, but I can smell the ugliness ahead when I add parameters to the search.
-, , BeginForm, "System.Web.Mvc.Form". ?