@manhnguyenv

Welcome to my blog!

ModelState AddModelError

April 23, 2019 15:50

ModelState AddModelError (edit)

https://exceptionnotfound.net/asp-net-mvc-demystified-modelstate/

https://www.tutorialsteacher.com/mvc/htmlhelper-validationsummary

https://stackoverflow.com/questions/15404270/modelstate-addmodelerror-not-showing-any-message

One way

ModelState.AddModelError("PROGRAM_ID", "Access for this program already exists.");
return View();
@Html.ValidationMessage("PROGRAM_ID")

Second way

ModelState.AddModelError("", "Access for this program already exists.");
return View();

@Html.ValidationMessage("")
 
 

Categories

Recent posts