473,385 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

looking for a Date Time Control..

RSB
Hi Every one ,
IS there any Date Time Control with .Net. All i want to read is the Date and
Time in a Single Field like 12/31/2004 09:23:23AM.
if there is any then any examples for it. and if not then how to Validate
the Text field for above.

thanks
RSB
Nov 18 '05 #1
3 3693
You can use CompareValidator by setting
Operator property to DataTypeCheck and Type property to DateTime, then for
the control set in the ControlToValidate the CompareValidator will get the
entered data and will try to convert it to the given type. if the data is
incorrect the CompareValidator will rise an error messsage.

When you use Operator=DataTypeCheck then the ControlToCompare is ignored

Regards
Martin

"RSB" <rs*****@hotmail.com> wrote in message
news:#H**************@TK2MSFTNGP09.phx.gbl...
Hi Every one ,
IS there any Date Time Control with .Net. All i want to read is the Date and Time in a Single Field like 12/31/2004 09:23:23AM.
if there is any then any examples for it. and if not then how to Validate
the Text field for above.

thanks
RSB

Nov 18 '05 #2
RSB
Hi Martin,
Thanks for he reply..
Now i was checking the CompareValidator and for "TYPE" property it does not
support DateTime.. it only supports Date..
Please advice.
is there any Control as such which provides me the both..

thanks

RSB

"Martin Marinov" <me********@mecrossroad.bg> wrote in message
news:ed*************@TK2MSFTNGP12.phx.gbl...
You can use CompareValidator by setting
Operator property to DataTypeCheck and Type property to DateTime, then for
the control set in the ControlToValidate the CompareValidator will get the
entered data and will try to convert it to the given type. if the data is
incorrect the CompareValidator will rise an error messsage.

When you use Operator=DataTypeCheck then the ControlToCompare is ignored

Regards
Martin

"RSB" <rs*****@hotmail.com> wrote in message
news:#H**************@TK2MSFTNGP09.phx.gbl...
Hi Every one ,
IS there any Date Time Control with .Net. All i want to read is the Date and Time in a Single Field like 12/31/2004 09:23:23AM.
if there is any then any examples for it. and if not then how to Validate
the Text field for above.

thanks
RSB


Nov 18 '05 #3
You are correct that the CompareValidator does not support Date + Time. You
will have to write a custom validator or consider an alternative design.
With a CustomValidator, on the server side you can use the DateTime
structure's ParseExact() method. If it throws an exception, it indicates a
bad entry.

May I suggest an alternative design? By combining both date and time into
one textbox, you are asking for the user to be very careful with formatting.
Users have to know both date and time patterns that you are expecting, plus
any separator rule. Often you assist users in entering dates with a popup
calendar. Time might have similar tools. If you allowed separate date and
time fields, you not only can add a popup calendar, but its also easier to
install client-side keystroke filtering to avoid illegal character entry.
Finally, these separate fields are easier to validate. You know that
CompareValidator can handle a date. You still would have to build a
validator for time.

My "Peter's Date Package" is a solution that includes datetextbox with popup
calendar, timeofdaytextbox, and validators for both. The two fields can
interact together. You can get and set one DateTime value and the software
interacts with both. http://www.peterblum.com/datecontrols/home.aspx.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"RSB" <rs*****@hotmail.com> wrote in message
news:O6*************@TK2MSFTNGP12.phx.gbl...
Hi Martin,
Thanks for he reply..
Now i was checking the CompareValidator and for "TYPE" property it does not support DateTime.. it only supports Date..
Please advice.
is there any Control as such which provides me the both..

thanks

RSB

"Martin Marinov" <me********@mecrossroad.bg> wrote in message
news:ed*************@TK2MSFTNGP12.phx.gbl...
You can use CompareValidator by setting
Operator property to DataTypeCheck and Type property to DateTime, then for
the control set in the ControlToValidate the CompareValidator will get the
entered data and will try to convert it to the given type. if the data is
incorrect the CompareValidator will rise an error messsage.

When you use Operator=DataTypeCheck then the ControlToCompare is ignored

Regards
Martin

"RSB" <rs*****@hotmail.com> wrote in message
news:#H**************@TK2MSFTNGP09.phx.gbl...
Hi Every one ,
IS there any Date Time Control with .Net. All i want to read is the Date

and
Time in a Single Field like 12/31/2004 09:23:23AM.
if there is any then any examples for it. and if not then how to Validate the Text field for above.

thanks
RSB


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Hussein Patwa | last post by:
Hi there. I'm new to this group. I'm also partially sighted so navigating the web is sometimes quite difficult. I'm looking for a javascript date picker, you know the ones that travel sites...
3
by: Marauderz | last post by:
Hello guys, got a little question regarding the regional language settings . Anyway I got a Windows 2003 Server machine that was installed with the date format "dd/MM/yyyy" and location still...
1
by: billy | last post by:
Ok, here's the situation... I have a user control that contains two textboxes (one for a from date/time and one for a to date/time) and two image buttons. The user control itself is supposed to...
8
by: gumi | last post by:
Hi, I am looking for code for a alarm clock program that pops up a messege to be used as part of my VB.Net class project. Any help is very much appreciated. Thanks
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
4
by: Michel Posseth [MCP] | last post by:
I have a problem with the date time picker validate event wich i believe is a bug How to reproduce : throw on a form a date time picker control and a textbox control select the validating...
1
by: Susan Bricker | last post by:
Greetings. I have a report (actually all of my reports in an MDB) that I want to date/time stamp at the bottom. Previously, I had used the builtin function of Now(). I thought that would give...
0
by: fredloh | last post by:
i have a tab control on my form. i then have several microsoft date and time picker control on the tab control. when i select a date on any of the date and time picker control, the result of the...
2
by: fniles | last post by:
I am using VB.NET 2005, and I am looking for a free calendar component that looks like "Control Panel" - "Date and Time". Does it exist ? Thank you
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.