This application is not supported on mobile browsers.

Conclusion

Good work! Try the interactive sample to see validation in action.

Note: The only valid credentials are [email protected] and CorrectHorseBatteryStaple.


Summary

  • DataAnnotation attributes are the simplest form of validation.
  • The Validator control can be used to show validation messages.
  • Custom errors can be created in commands using the AddModelError extension method.

Note: There are other validation concepts like IValidatableObject, the ValidationSummary control, and the Validation.Target attached property. These are beyond the scope of this lesson.

Interactive sample: Basic validation

Download Solution