5
Reply

In Server how to check whether model has error or not in ASP.Net MVC?

Ritesh Singh

Ritesh Singh

8y
502
0
Reply

    With the help of Data Annotation we check the model has error or not Example : public ActionResult Index(Models model){if (ModelState.IsValid) //this provide bool result for model is valid or not{ViewBag.Name = model.Name;ViewBag.Email = model.Email;}return View(model);}

    With the help of Data Annotation we check the model has error or not Example : public ActionResult Index(Models model){if (ModelState.IsValid) //this provide bool result for model is valid or not{ViewBag.Name = model.Name;ViewBag.Email = model.Email;}return View(model);}

    With the help of Data Annotation we check the model has error or not Example : public ActionResult Index(Models model){if (ModelState.IsValid) //this provide bool result for model is valid or not{ViewBag.Name = model.Name;ViewBag.Email = model.Email;}return View(model);}

    With the help of Data Annotation we check the model has error or not Example : public ActionResult Index(Models model){if (ModelState.IsValid) //this provide bool result for model is valid or not{ViewBag.Name = model.Name;ViewBag.Email = model.Email;}return View(model);}

    With the help of Data Annotation we check the model has error or not Example : public ActionResult Index(Models model){if (ModelState.IsValid) //this provide bool result for model is valid or not{ViewBag.Name = model.Name;ViewBag.Email = model.Email;}return View(model);}