date validation using validation controls

arun_mrk

Well-known member
Joined
Apr 1, 2003
Messages
51
Location
beijing
Could some help me

i have two textbox to enter the from and to date

I Have to perform validation like
1. is from date valid
2. is to date valid
3. is to date less than from date

Using which validation control can i achieve the task?
 
You would need to use the custom validator and build a regular expression to check the dates and then compare the 2 values if theyre both dates.

Sorry, Im pretty useless at regular expressions, but there are plenty of examples on the web.

John
 
Also, Dates have built in < and > operators;
Code:
If dateA < dateB Then
  dateA comes before dateB
End If
 
hi
I was mainly asking about validation control because i wanted the validation to take place in client side and not in server side.
Could some help me with some code example or how to use the validation control for the above task?
 
The default functionality of Validation Controls take place client side. They produce their own java script (or vb script, depending on the settings you have it).

You can make sure of this by setting a Validation Controls EnableClientScript property to true.

As for dates.. you can use the Compare Validator Control to compare dates and display errors appropriately by setting the Type property to ValidationDataType.Date and then setting the Operator property appropriately.
 
Last edited by a moderator:
Back
Top