Here Mudassar Ahmed Khan has explained with an example, how to use ModelState.IsValid property in ASP.Net MVC Razor.
ModelState.IsValid property is an inbuilt property of ASP.Net MVC which verifies two things:
1. Whether the Form values are bound to the Model.
2. All the validations specified inside Model class using Data annotations have been passed.
ModelState.IsValid property can be used to perform some logical operations based on the values submitted by the User.
↧