-
1
- #1
Hey guys,
If you get a chance, I STRONGLY urge you to pick up the July issue of ASP.NET Pro magazine. They have some great articles this month, including one that I got this tip from.
I always thought the Compare Validator control was used for comparing a to b, 1 to 2, etc. etc. BUT, you can also use it to compare datatypes! Below is the tag showing how you would set it up for Date validation (for vs.net people, the properties are the same, just different interface)
<asp:CompareValidator
ID="DateCompare"
Runat="server"
ControlToValidate="YourControl"
Type="Date"
Operator="DataTypeCheck"
ErrorMessage="YourErrorMessageHere"
/>
How smart is this validator? Smart enough to know that there was only 28 days in Feb this year, and 29 days in Feb 2004.
hth
Jack
If you get a chance, I STRONGLY urge you to pick up the July issue of ASP.NET Pro magazine. They have some great articles this month, including one that I got this tip from.
I always thought the Compare Validator control was used for comparing a to b, 1 to 2, etc. etc. BUT, you can also use it to compare datatypes! Below is the tag showing how you would set it up for Date validation (for vs.net people, the properties are the same, just different interface)
<asp:CompareValidator
ID="DateCompare"
Runat="server"
ControlToValidate="YourControl"
Type="Date"
Operator="DataTypeCheck"
ErrorMessage="YourErrorMessageHere"
/>
How smart is this validator? Smart enough to know that there was only 28 days in Feb this year, and 29 days in Feb 2004.
hth
Jack