Q: compare validator for date

Discussion in 'ASP .Net' started by =?Utf-8?B?SklNLkgu?=, Aug 26, 2005.

  1. 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,
     
    =?Utf-8?B?SklNLkgu?=, Aug 26, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?SklNLkgu?=

    Peter Blum Guest

    Re: compare validator for date

    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/DateControls/TimeMain.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:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx

    "JIM.H." <> wrote in message
    news:...
    > 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,
    >
     
    Peter Blum, Aug 26, 2005
    #2
    1. Advertising

  3. 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,
    >
     
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tp?=, Aug 26, 2005
    #3
  4. 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,
    > >
     
    =?Utf-8?B?SklNLkgu?=, Aug 26, 2005
    #4
  5. Hi,

    This is very simple. Here you have quick tutorial tu validatiors:
    http://samples.gotdotnet.com/quickstart/aspplus/doc/webvalidation.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,
    > > >
     
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tp?=, Aug 26, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James P.
    Replies:
    7
    Views:
    12,732
    phamtasmic
    Jul 13, 2004
  2. =?Utf-8?B?YmFieg==?=

    Compare Validator not comparing date

    =?Utf-8?B?YmFieg==?=, May 27, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    710
    =?Utf-8?B?YmFieg==?=
    May 27, 2005
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,361
    Michael Borgwardt
    May 30, 2004
  4. Mike P

    Compare Validator and date format

    Mike P, Jun 6, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    3,378
    Mike P
    Jun 6, 2006
  5. Shailesh Katti

    compare validator to validate date in user control

    Shailesh Katti, Jul 27, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    810
    Teemu Keiski
    Jul 28, 2003
Loading...

Share This Page