ValidateExpression for Day,Month and Year
The code sample contains basic validation expressions generally needed in every application. Users should be allowed to enter only valid day,month and year values for a particular date.
In this code snippet uses regular expression validator and sets it's validation expression property. This example is very useful when clients don't need calender control.
ValidationExpression for Day
Day: ValidationExpression="^((([1-9]?)|([1-2][0-9])?)|([3][0-1]?))$"
ValidationExpression for Month
ValidationExpression="^((([1-9]?)|([0][1-9])?)|([1][0-2]?))$"
ValidationExpression for Year
ValidationExpression="[0-9]{4}"
In this code snippet uses regular expression validator and sets it's validation expression property. This example is very useful when clients don't need calender control.
ValidationExpression for Day
Day: ValidationExpression="^((([1-9]?)|([1-2][0-9])?)|([3][0-1]?))$"
ValidationExpression for Month
ValidationExpression="^((([1-9]?)|([0][1-9])?)|([1][0-2]?))$"
ValidationExpression for Year
ValidationExpression="[0-9]{4}"
Labels: Regular Expression

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home