View Single Post
  #9 (permalink)  
Old February 11th, 2012, 07:44 PM
Mike Brind Mike Brind is offline
Wrox Author
Points: 412, Level: 7
Points: 412, Level: 7 Points: 412, Level: 7 Points: 412, Level: 7
Activity: 28%
Activity: 28% Activity: 28% Activity: 28%
 
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 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)