public ActionResult VehicleLoanBasicDetailsSave(FormCollection form)
{
if (form["nameofapplicant"].Trim().Length == 0)
ModelState.AddModelError("Name", "Name is required");
return PartialView("_VehicleLoanBasicDetails");
}
In controller ,I wrote validations like that.But i need to display that errors .Can u tell me how to display the errors
Jaganathan BantheswaranPosted Feb 8, 2014, 7:07 AM
In your view, next to the Name control,
@Html.ValidationMessageFor(model => model.Name)
The ValidationMessageFor will render the error message if there.