Validate date using validation controls

P

Paul

Hi,

I have a form where a user is required to enter a start date and an
end date. Both are required and must between a specific date range
(e.g. 01/01/1900 and 01/01/2099) and the end date cannot preceed the
start date. How can I perform the necessary validation using the least
number of validation controls. For example is it necessary that I add
a requiredfieldvalidator for the start date field and end date field
to make sure a value has been entered, a rangevalidator for the start
date and end date field to make sure the values are in the specified
range and a comparevalidator to make sure that the end date does not
preceed the end date. 5 controls seems a bit excessive.

Thanks

Paul
 
J

JohnG

The only other option would be to create a custom validator by deriving from
the BaseValidator control.
 
H

Hermit Dave

well use a custom validation control... and write your own client side and
server side script.
bind validation code to the control and attach it to one of the field.. say
startdate field...
do your validations and return isvalid to false it not...
it should being the custom validation control togather with the rest of the
validation code in the right sequence.

http://aspnet.4guysfromrolla.com/articles/073102-1.aspx
http://samples.gotdotnet.com/quicks...lref/webctrl/customvalidator/doc_custval.aspx

you would find lot more info on www.msdn.com
hope this helps..
 
P

Peter Blum

Here's a commercial solution that will put all the validators under one
error message without writing any custom code (especially figuring it all
out in JavaScript). My product, "Professional Validation And More", offers
the MultiConditionValidator. Its job is to allow you to blend the logic of
all other validators under one error message. Details are at
http://www.peterblum.com/vam/home.aspx.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top