View Single Post
  #9 (permalink)  
Old February 11th, 2012, 07:44 PM
Mike Brind Mike Brind is offline
Wrox Author
Points: 406, Level: 7
Points: 406, Level: 7 Points: 406, Level: 7 Points: 406, Level: 7
Activity: 16%
Activity: 16% Activity: 16% Activity: 16%
 
Join Date: Dec 2011
Posts: 55
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)