Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Q: compare validator for date

Reply
Thread Tools

Q: compare validator for date

 
 
=?Utf-8?B?SklNLkgu?=
Guest
Posts: n/a
 
      08-26-2005
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,

 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      08-26-2005
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: http://www.velocityreviews.com/forums/(E-Mail Removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"JIM.H." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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,
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tp?=
Guest
Posts: n/a
 
      08-26-2005
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,
>

 
Reply With Quote
 
=?Utf-8?B?SklNLkgu?=
Guest
Posts: n/a
 
      08-26-2005
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,
> >

 
Reply With Quote
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tp?=
Guest
Posts: n/a
 
      08-26-2005
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,
> > >

 
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
Compare Validator Date Format Anjut Software 1 10-26-2009 10:55 AM
Compare Validator and date format Mike P ASP .Net 0 06-06-2006 02:58 PM
Compare Validator not comparing date =?Utf-8?B?YmFieg==?= ASP .Net 0 05-27-2005 03:36 PM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
compare validator to validate date in user control Shailesh Katti ASP .Net Web Controls 1 07-28-2003 11:20 AM



Advertisments