Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Validate date using validation controls

Reply
Thread Tools

Validate date using validation controls

 
 
Paul
Guest
Posts: n/a
 
      01-20-2004
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
 
Reply With Quote
 
 
 
 
zPaul
Guest
Posts: n/a
 
      01-20-2004
Use custom validator.

"Paul" <> wrote in message
news: 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



 
Reply With Quote
 
 
 
 
JohnG
Guest
Posts: n/a
 
      01-20-2004
The only other option would be to create a custom validator by deriving from
the BaseValidator control.


"Paul" <> wrote in message
news: 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



 
Reply With Quote
 
Hermit Dave
Guest
Posts: n/a
 
      01-20-2004
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" <> wrote in message
news: 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



 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      01-21-2004
Thanks zPaul
 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      01-21-2004
Thanks JohnG
 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      01-21-2004
Thanks HD
 
Reply With Quote
 
Peter Blum
Guest
Posts: n/a
 
      01-21-2004
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:

"Paul" <> wrote in message
news: 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validate Date AND Tme not just date Chris Davoli ASP .Net Web Controls 0 01-28-2009 09:27 PM
setting date format to validate date in ruby Jay Pangmi Ruby 4 08-25-2008 03:57 PM
Validation controls validate before form submits TS ASP .Net Web Controls 5 06-28-2005 02:23 PM
how to compare current date to a future date and validate it in ASP.NET James P. ASP .Net 7 07-13-2004 10:13 PM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57