Conclusion
Good work! Try the interactive sample to see validation in action.
Note: The only valid credentials are
[email protected]
andCorrectHorseBatteryStaple
.
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.