The validator mainly checks the format of the provided value. If you'd like only to accept inputs in specified format you can set the Page Culture property manually. In case of Date type it also checks the range (e.g. I like this feature, especially that I've already seen a quite complex custom validator written to do exact this task. The same date "" will be validated differently for UK and US Cultures (in UK "DD. Compare Validator, as the name says, is mainly used to compare value of specified control against value of another control, constant, etc.You can specify the operator that can be used in comparison so you are not limited to checking equality.We used Compare Validator for validating date (“Data Type Check” operator).
For business applications, data validation can be defined through declarative data integrity rules or procedure-based business rules. These attributes are helpful for common validation requirements like Required, Range, Regular Expression, String Length etc.
It helps you to validate model data received from user.
It gives you many in built validation attributes like String Length, Required, Data Type for validating model.
You will have to create custom validation to achieve this functionality. Is Valid method takes Value and Validation Context object as input parameters.
Open application created in previous step and new class to Models folder. Value represent the value of model property for which this custom validation applies.