Execution order of Validation Controls

Discussion in 'ASP .Net' started by Bijoy Naick, Jun 8, 2004.

  1. Bijoy Naick

    Bijoy Naick Guest

    I have 3 labels called eventDate, eventStartTime and eventEndTime.

    I have 3 validators as well. One checks to make sure that a date is
    specified (RequiredFieldValidator), the other makes sure that the date
    is valid (CompareFieldValidator) and the third (a custom validator)
    makes sure that the eventStartTime is before the eventEndTIme. The
    custom validator takes the eventDate and start/end times, creates 2
    variables of type DateTime and does a compare.

    Is there a way for me to define the order in which the validators will
    run? I'd like the Required to run first, follwoed by the Compare and
    then the Custom.

    Thx.

    Bijoy


    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Bijoy Naick, Jun 8, 2004
    #1
    1. Advertising

  2. You can do it manually
    e.g.
    on submit, instead of call Page.Validate() method you can use

    RequiredFieldValidator.Validate();
    if ( RequiredFieldValidator.IsValid )
    {
    CompareFieldValidator.Validate();
    if ( CompareFieldValidator.IsValid )
    {
    CustomValidator.Validate();
    if ( CustomValidator.IsValid )
    {
    }
    }
    }

    for this you have to perform the validation on the server and set the
    EnableClientScript = False

    Regards
    Martin

    "Bijoy Naick" <> wrote in message
    news:...
    > I have 3 labels called eventDate, eventStartTime and eventEndTime.
    >
    > I have 3 validators as well. One checks to make sure that a date is
    > specified (RequiredFieldValidator), the other makes sure that the date
    > is valid (CompareFieldValidator) and the third (a custom validator)
    > makes sure that the eventStartTime is before the eventEndTIme. The
    > custom validator takes the eventDate and start/end times, creates 2
    > variables of type DateTime and does a compare.
    >
    > Is there a way for me to define the order in which the validators will
    > run? I'd like the Required to run first, follwoed by the Compare and
    > then the Custom.
    >
    > Thx.
    >
    > Bijoy
    >
    >
    > *** Sent via Devdex http://www.devdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Martin Marinov, Jun 8, 2004
    #2
    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. priya
    Replies:
    0
    Views:
    1,251
    priya
    Oct 3, 2005
  2. =?Utf-8?B?QmlsbCBCb3Jn?=

    Execution order of PageLoad for user controls

    =?Utf-8?B?QmlsbCBCb3Jn?=, Mar 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    3,392
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Mar 6, 2004
  3. John Saunders

    Re: A question about order of execution?

    John Saunders, Jul 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    372
    S. Justin Gengo
    Jul 15, 2004
  4. S. Justin Gengo

    Re: A question about order of execution?

    S. Justin Gengo, Jul 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,067
    S. Justin Gengo
    Jul 15, 2004
  5. Ignacio Machin \( .NET/ C#  MVP \)

    order of execution of page_load in a base and derived classes

    Ignacio Machin \( .NET/ C# MVP \), Sep 1, 2004, in forum: ASP .Net
    Replies:
    13
    Views:
    922
    Ignacio Machin \( .NET/ C# MVP \)
    Sep 2, 2004
Loading...

Share This Page