Hi Folks,
If you want to access the ModelState property in the View , you can use the ModelState in your Razor View as depicted below in image:
This is the source code as shown below:
- @model IEnumerable<MVCSample.Models.EmpRegistration>
- @{
- ViewBag.Title = "Verify";
-
- if (@ViewContext.ViewData.ModelState.IsValid)
- {
- ViewBag.Title = "Verify";
-
- if (TempData["EmployeeRegistration"] != null)
- {
- var tempDataEmployeeRegistration = TempData["EmployeeRegistration"];
- }
- }
- }
Thanks
To learn more about MVC please go to the following link.
MVC Articles
Thanks.
Enjoy coding and reading.