I made a form with @using(Ajax.BeginForm){}. It posts to a method in my controller that returns a PartialViewResult. It works fine when everything is valid, but what should I return if
it's not (e.g., the modelstate is not valid)?
How Ajax.BeginForm can manage the error? What I return to manage the Failure?
@using(Ajax.BeginForm("Create", "Room", new AjaxOptions { HttpMethod="POST",
UpdateTargetId="formRoom", InsertionMode= InsertionMode.Replace, onFailure =??})) {
public PartialViewResult Create(Movie mov)
{
if (ModelState.IsValid)
{
db.Save(mov);
return PartialView("CreateResult", mov);
}
return null;
}
Thanks!