By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,209 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,209 IT Pros & Developers. It's quick & easy.

Validate date using validation controls

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Use custom validator.

"Paul" <pa********@hotmail.com> wrote in message
news:ca**************************@posting.google.c om...
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

Nov 18 '05 #2

P: n/a
The only other option would be to create a custom validator by deriving from
the BaseValidator control.
"Paul" <pa********@hotmail.com> wrote in message
news:ca**************************@posting.google.c om...
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

Nov 18 '05 #3

P: n/a
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/quickst...c_custval.aspx

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

Regards,

HD
"Paul" <pa********@hotmail.com> wrote in message
news:ca**************************@posting.google.c om...
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

Nov 18 '05 #4

P: n/a
Thanks zPaul
Nov 18 '05 #5

P: n/a
Thanks JohnG
Nov 18 '05 #6

P: n/a
Thanks HD
Nov 18 '05 #7

P: n/a
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: PL****@PeterBlum.com

"Paul" <pa********@hotmail.com> wrote in message
news:ca**************************@posting.google.c om...
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

Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.