If you change the action method to have FormCollectionas the last parameter, you can pass an instance FormCollectioncontaining all of your values. The MVC structure will automatically pass values from the form inside this parameter when live starts.
public ActionResult MyMethod(FormCollection form)
{
}
.
Edit
:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create([Bind()]Person person, FormCollection form)
{
if (form["DateOfBirth"].ToString() == "")
{
TempData["message"] = "Please select a date of Birth";
ViewData["DateOfBirth"] = form["DateOfBirth"].ToString();
MvcValidationAdapter.TransferValidationMessagesTo(
ViewData.ModelState, person.ValidationMessages);
return View();
}
else
{
if (person.IsValid())
{
person.DateOfBirth = Convert.ToDateTime(form["DateOfBirth"]);
personRepository.SaveOrUpdate(person);
TempData["message"] =
person.Firstname + " was successfully added";
return RedirectToAction(
"Create", "OrderDetails", new { id = person.ID });
}
else
{
ViewData["DateOfBirth"] = form["DateOfBirth"].ToString();
MvcValidationAdapter.TransferValidationMessagesTo(
ViewData.ModelState, person.ValidationMessages);
return View();
}
}
}