View Single Post
  #9 (permalink)  
Old February 11th, 2012, 06:44 PM
Mike Brind Mike Brind is offline
Wrox Author
Points: 388, Level: 6
Points: 388, Level: 6 Points: 388, Level: 6 Points: 388, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 53
Thanks: 1
Thanked 18 Times in 18 Posts
Default

Your code currently shows the error message if there are no errors, or when ModelState.IsValid. You need to change that line by adding ! before ModelState.IsValid:

if(!ModelState.IsValid){
ModelState.AddFormError(@"Please fix the errors below before resubmitting the form");
}
Reply With Quote
The Following User Says Thank You to Mike Brind For This Useful Post:
hozdaman (February 15th, 2012)