473,395 Members | 1,678 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,395 software developers and data experts.

Q: compare validator for date

Hello,

I put a compare validator in to my applications and set the type as Date. It
works for “MM/dd/yyyy” but not for “MM/dd/yyyy hh:mm:ss”. How can I validate
time part too?

Thanks,

Nov 19 '05 #1
4 6120
None of the built in validators handle time. When you use Type=Date, it only
means date.

You have several choices:
1. Create a custom validator that will handle the format you want.
2. I recommend splitting the date and time into two textboxes. This will
help the user in several ways:
- You can use a DatePicker with popup calendar for the date. There are many
available
- There are many separate time entry controls.
- You can assign a validator to individual textboxes and just validate the
format of a single data element. (With Date+Time, you have two elements that
may be incorrect. Users appreciate error messages that are specific.)

I created one of the available datepickers and time textboxes with my
Peter's Date Package (http://www.peterblum.com/datecontrols/home.aspx). You
can see a demo of date + time working together here:
http://www.peterblum.com/DateControl...Main.aspx#Demo (see "Demo 5").
My two controls are actually connected so that you assign one DateTime
object and puts the parts into the individual controls.
In addition, I've included validators for date and time.

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

"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:86**********************************@microsof t.com...
Hello,

I put a compare validator in to my applications and set the type as Date.
It
works for "MM/dd/yyyy" but not for "MM/dd/yyyy hh:mm:ss". How can I
validate
time part too?

Thanks,

Nov 19 '05 #2
Hi,

I think you cannot do it using compare validator. Use Customvalidator
instead.
--
Milosz Skalecki
MCP, MCAD
"JIM.H." wrote:
Hello,

I put a compare validator in to my applications and set the type as Date. It
works for “MM/dd/yyyy” but not for “MM/dd/yyyy hh:mm:ss”. How can I validate
time part too?

Thanks,

Nov 19 '05 #3
I have never used CustomValidator, is there any example to show me what
exactly I should do?

"Milosz Skalecki" wrote:
Hi,

I think you cannot do it using compare validator. Use Customvalidator
instead.
--
Milosz Skalecki
MCP, MCAD
"JIM.H." wrote:
Hello,

I put a compare validator in to my applications and set the type as Date. It
works for “MM/dd/yyyy” but not for “MM/dd/yyyy hh:mm:ss”. How can I validate
time part too?

Thanks,

Nov 19 '05 #4
Hi,

This is very simple. Here you have quick tutorial tu validatiors:
http://samples.gotdotnet.com/quickst...alidation.aspx

--
Milosz Skalecki
MCP, MCAD
"JIM.H." wrote:
I have never used CustomValidator, is there any example to show me what
exactly I should do?

"Milosz Skalecki" wrote:
Hi,

I think you cannot do it using compare validator. Use Customvalidator
instead.
--
Milosz Skalecki
MCP, MCAD
"JIM.H." wrote:
Hello,

I put a compare validator in to my applications and set the type as Date. It
works for “MM/dd/yyyy” but not for “MM/dd/yyyy hh:mm:ss”. How can I validate
time part too?

Thanks,

Nov 19 '05 #5

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

Similar topics

0
by: Stephen | last post by:
Can someone help me. I'm trying to use the following validator control and compare a date to a date defined in the code-behind page. My code is below along with my error message I get when the page...
1
by: dotnet beginner | last post by:
In my webform I check for dirty(textbox values changed), and pop up a confirm dialog box on an asp-Imagebutton click event. I wrote a javascript function (to pop up confirm box) and called it in...
0
by: TN Bella | last post by:
Hi, I am trying to get my compare validator to fire properly...Since I have panels the validator wouldn't work properly, the app would fire right but would insert the data regardless and the...
0
by: babz | last post by:
Hi I am facing one peculiar problem. When I tried to compare control value with the current date, it is not validating. All I am doing is in the Page Load I have a code ...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
0
by: Mike P | last post by:
What date format does the Compare Validator check against? The date format of the web server or of the client? <asp:CompareValidator ID="CompareValidator2" runat="server" Display="None"...
0
by: David Hearn | last post by:
I have a user control that I created that I use in one page right now. It has a textbox in it that is used to enter a date. I am using a compare validator to validate the date format which works...
4
by: hellboss | last post by:
Hi Every one ! Im using asp .net vs05 , i My form im using two text boxes where the Date is entered in any format (dd/mm/yyy or dd/MMM/yyyy) Ex : From date ,To Date Now ! How do i Ensure that...
1
by: vrparekh | last post by:
in my webapplication,user pick date in dd/mm/yy format, and i want to compare that date with another date using compare validator but compare validator compare the dates using mm/dd/yy format. ...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.