Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Validate date using validation controls (http://www.velocityreviews.com/forums/t71019-validate-date-using-validation-controls.html)

Paul 01-20-2004 04:12 PM

Validate date using validation controls
 
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

zPaul 01-20-2004 04:54 PM

Re: Validate date using validation controls
 
Use custom validator.

"Paul" <paulsmith5@hotmail.com> wrote in message
news:ca236fb1.0401200812.184c39eb@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




JohnG 01-20-2004 04:59 PM

Re: Validate date using validation controls
 
The only other option would be to create a custom validator by deriving from
the BaseValidator control.


"Paul" <paulsmith5@hotmail.com> wrote in message
news:ca236fb1.0401200812.184c39eb@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




Hermit Dave 01-20-2004 05:41 PM

Re: Validate date using validation controls
 
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" <paulsmith5@hotmail.com> wrote in message
news:ca236fb1.0401200812.184c39eb@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




Paul 01-21-2004 09:36 AM

Re: Validate date using validation controls
 
Thanks zPaul

Paul 01-21-2004 09:36 AM

Re: Validate date using validation controls
 
Thanks JohnG

Paul 01-21-2004 09:37 AM

Re: Validate date using validation controls
 
Thanks HD

Peter Blum 01-21-2004 10:22 PM

Re: Validate date using validation controls
 
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: PLBlum@PeterBlum.com

"Paul" <paulsmith5@hotmail.com> wrote in message
news:ca236fb1.0401200812.184c39eb@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





All times are GMT. The time now is 05:15 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.