Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy Date Validation 1

Status
Not open for further replies.

jfrost10

Programmer
Jun 3, 2001
2,004
CA
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=&quot;DateCompare&quot;
Runat=&quot;server&quot;
ControlToValidate=&quot;YourControl&quot;
Type=&quot;Date&quot;
Operator=&quot;DataTypeCheck&quot;
ErrorMessage=&quot;YourErrorMessageHere&quot;
/>


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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top