Validate date using validation controls

Discussion in 'ASP .Net' started by Paul, Jan 20, 2004.

  1. Paul

    Paul Guest

    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 requiredfieldvalidator 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 comparevalidator to make sure that the end date does not
    preceed the end date. 5 controls seems a bit excessive.

    Thanks

    Paul
     
    Paul, Jan 20, 2004
    #1
    1. Advertising

  2. Paul

    zPaul Guest

    Use custom validator.

    "Paul" <> wrote in message
    news:...
    > 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 requiredfieldvalidator 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 comparevalidator to make sure that the end date does not
    > preceed the end date. 5 controls seems a bit excessive.
    >
    > Thanks
    >
    > Paul
     
    zPaul, Jan 20, 2004
    #2
    1. Advertising

  3. Paul

    JohnG Guest

    The only other option would be to create a custom validator by deriving from
    the BaseValidator control.


    "Paul" <> wrote in message
    news:...
    > 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 requiredfieldvalidator 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 comparevalidator to make sure that the end date does not
    > preceed the end date. 5 controls seems a bit excessive.
    >
    > Thanks
    >
    > Paul
     
    JohnG, Jan 20, 2004
    #3
  4. Paul

    Hermit Dave Guest

    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/quicks...lref/webctrl/customvalidator/doc_custval.aspx

    you would find lot more info on www.msdn.com
    hope this helps..
    --

    Regards,

    HD
    "Paul" <> wrote in message
    news:...
    > 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 requiredfieldvalidator 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 comparevalidator to make sure that the end date does not
    > preceed the end date. 5 controls seems a bit excessive.
    >
    > Thanks
    >
    > Paul
     
    Hermit Dave, Jan 20, 2004
    #4
  5. Paul

    Paul Guest

    Thanks zPaul
     
    Paul, Jan 21, 2004
    #5
  6. Paul

    Paul Guest

    Thanks JohnG
     
    Paul, Jan 21, 2004
    #6
  7. Paul

    Paul Guest

    Thanks HD
     
    Paul, Jan 21, 2004
    #7
  8. Paul

    Peter Blum Guest

    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, "Professional Validation And More", offers
    the MultiConditionValidator. 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:

    "Paul" <> wrote in message
    news:...
    > 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 requiredfieldvalidator 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 comparevalidator to make sure that the end date does not
    > preceed the end date. 5 controls seems a bit excessive.
    >
    > Thanks
    >
    > Paul
     
    Peter Blum, Jan 21, 2004
    #8
    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,526
    phamtasmic
    Jul 13, 2004
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,279
    Michael Borgwardt
    May 30, 2004
  3. TS

    Validation controls validate before form submits

    TS, Jun 24, 2005, in forum: ASP .Net Web Controls
    Replies:
    5
    Views:
    198
  4. Chris Davoli

    Validate Date AND Tme not just date

    Chris Davoli, Jan 28, 2009, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    172
    Chris Davoli
    Jan 28, 2009
  5. Jay Pangmi
    Replies:
    4
    Views:
    666
    Suraj Kurapati
    Aug 25, 2008
Loading...

Share This Page