The story behind is that we had an application which heavily used Validator Callout Extender for displaying validation errors.

validating date in asp net-60

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.

To not rewrite validation (displaying validation messages) in whole application we came to the following solution.

Validation must be done on client side to show Validator Callout Extender, so we used Custom Validator which perform date validation on server side and use ajax on client side to call the same method on server side.

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.The following example demonstrates simple comparison of int values (max Except the basic functionality Compare Validator supports validation of data types.Except the regular operators (Equal, Greater Than, Greater Than Equal, Less Than & Less Than Equal) Compare Validator supports an additional one called .The Is Date function returns a Boolean value that indicates if the evaluated expression can be converted to a date.It returns True if the expression is a date or can be converted to a date; otherwise, it returns False.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.