473,573 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 requiredfieldva lidator 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 comparevalidato r 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
7 10299
Use custom validator.

"Paul" <pa********@hot mail.com> wrote in message
news:ca******** *************** ***@posting.goo gle.com...
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 requiredfieldva lidator 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 comparevalidato r 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
The only other option would be to create a custom validator by deriving from
the BaseValidator control.
"Paul" <pa********@hot mail.com> wrote in message
news:ca******** *************** ***@posting.goo gle.com...
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 requiredfieldva lidator 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 comparevalidato r 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
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********@hot mail.com> wrote in message
news:ca******** *************** ***@posting.goo gle.com...
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 requiredfieldva lidator 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 comparevalidato r 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
Thanks zPaul
Nov 18 '05 #5
Thanks JohnG
Nov 18 '05 #6
Thanks HD
Nov 18 '05 #7
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, "Profession al Validation And More", offers
the MultiConditionV alidator. 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****@PeterBlu m.com

"Paul" <pa********@hot mail.com> wrote in message
news:ca******** *************** ***@posting.goo gle.com...
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 requiredfieldva lidator 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 comparevalidato r 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2822
by: Alexandre | last post by:
Hi again, What's the best I can do to validate fields like date before send my datas. thx
2
1621
by: Paul | last post by:
Hi, I hope somebody can help me with the following. (I have tried searching for a solution on the newsgroups but nothing is quite what I need. Feel free to point me in the direction of anything I may have missed though.) I have a form with 2 text boxes, two list boxes and 2 buttons (A & B). Both buttons must perform some validation but...
6
1961
by: RSB | last post by:
Hi Every one Need some help to Validate the Date i have in the Form. ALso how to Convert the Date Data i read from table to yyyy/MMM/dd format. Thanks RSB
7
31805
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the current date. If not, I'd like to display the error message to ValidationSummary. It seems to make sense to me to use CompareValidator but the...
2
1406
by: Fernando Lopes | last post by:
Hi. How can i validate a date textbox using validator, but the validator need to validate all data types, like: USA: 11/19/2004 BRAZIL: 19/11/2004 GERMANY: 19.11.2004 So, in the validator message, i need to show how is the mask according the country.
4
4275
by: Wysiwyg | last post by:
I need to validate a form to ensure that all of the fields add up correctly. I can't do this while the user is entering data since validation needs to be done after the entry is completed. What's the "best" way to validate prior to submitting? I could add an onsubmit attribute to the form which executes the validation in Javascript. That...
3
5948
by: Martin | last post by:
Hi, I am implemeting a form in asp.net. The form is quite large and the validation is reasonably complex, so I have decieded to implement my own validation rather than use any custon validators, so I have a button on the form and the "causes validation" property is set to true. I have overridden the "Validate()" like so
3
2937
by: Mike Logan | last post by:
How do I validate messages? If my schema has a simpleType with facets like "minExclusive" and "maxLength" will the .Net framework validate the message before running the web service? This is what one of my server stubs look like. <System.Web.Services.WebMethodAttribute(), _ ...
11
11747
by: jjbutera | last post by:
I know how to use the ErrorProvider in my winforms..or do I? I validate the values and set the ErrorProvider in the validating event. If not valid, I set e.Cancel = True. I clear the ErrorProvider in the validated event. Is there a way to know if all validated controls pass validation when the user clicks an OK button? In ASP.Net there's...
0
8027
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7788
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8066
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5594
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5292
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3733
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2216
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1304
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1041
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.