Catching a RequiredFiled Validator event in PageLoad or some other event?

Discussion in 'ASP .Net' started by Lars Netzel, Jul 22, 2004.

  1. Lars Netzel

    Lars Netzel Guest

    Hi!

    If I use a RequiredField Validator to make sure a TextBox is filled by a
    user and the user DOESN'T it triggers and shows the errortext of that
    control.

    I want more to happen on the page when that happens and is there an Event or
    something I can check that it has been triggered?

    Regards
    /Lars
     
    Lars Netzel, Jul 22, 2004
    #1
    1. Advertising

  2. Lars Netzel

    Greg Burns Guest

    I would guess your would need to create a Custom_Validator and not specify
    the control to validate (that way it will run even when your TextBox is
    empty).

    Inside your Custom_Validator check to see if the TextBox was empty and act
    on it.

    Greg

    "Lars Netzel" <[stop_spam]@host.topdomain> wrote in message
    news:e0E6yg%...
    > Hi!
    >
    > If I use a RequiredField Validator to make sure a TextBox is filled by a
    > user and the user DOESN'T it triggers and shows the errortext of that
    > control.
    >
    > I want more to happen on the page when that happens and is there an Event

    or
    > something I can check that it has been triggered?
    >
    > Regards
    > /Lars
    >
    >
     
    Greg Burns, Jul 22, 2004
    #2
    1. Advertising

  3. Lars Netzel

    DujHoD Guest

    I believe you can use the IsValid property of the validator itself to
    check this.

    http://msdn.microsoft.com/library/e...WebControlsBaseValidatorClassIsValidTopic.asp

    Note that validation happens AFTER the Page_Load event, so if you get
    this property in the Page_Load event, it will always return True,
    since the control has not yet been validated. If you must check
    validity in the Page_Load event, you can manually call the
    Page.Validate method (or just call the Validate method of the
    validator you want to check on).

    http://msdn.microsoft.com/library/en-us/dnaspp/html/aspplusvalid.asp


    "Lars Netzel" <[stop_spam]@host.topdomain> wrote in message news:<e0E6yg#>...
    > If I use a RequiredField Validator to make sure a TextBox is filled by a
    > user and the user DOESN'T it triggers and shows the errortext of that
    > control.
    >
    > I want more to happen on the page when that happens and is there an Event or
    > something I can check that it has been triggered?
     
    DujHoD, Jul 22, 2004
    #3
  4. Lars Netzel

    Greg Burns Guest

    BUT, if he has client-side validation turned on he may never get back to the
    server to run anything.

    Greg

    "DujHoD" <> wrote in message
    news:...
    > I believe you can use the IsValid property of the validator itself to
    > check this.
    >
    >

    http://msdn.microsoft.com/library/e...WebControlsBaseValidatorClassIsValidTopic.asp
    >
    > Note that validation happens AFTER the Page_Load event, so if you get
    > this property in the Page_Load event, it will always return True,
    > since the control has not yet been validated. If you must check
    > validity in the Page_Load event, you can manually call the
    > Page.Validate method (or just call the Validate method of the
    > validator you want to check on).
    >
    > http://msdn.microsoft.com/library/en-us/dnaspp/html/aspplusvalid.asp
    >
    >
    > "Lars Netzel" <[stop_spam]@host.topdomain> wrote in message

    news:<e0E6yg#>...
    > > If I use a RequiredField Validator to make sure a TextBox is filled by

    a
    > > user and the user DOESN'T it triggers and shows the errortext of that
    > > control.
    > >
    > > I want more to happen on the page when that happens and is there an

    Event or
    > > something I can check that it has been triggered?
     
    Greg Burns, Jul 22, 2004
    #4
    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. =?Utf-8?B?TWlrZQ==?=

    Caching and PageLoad event

    =?Utf-8?B?TWlrZQ==?=, Sep 24, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    477
    Egbert Nierop \(MVP for IIS\)
    Sep 24, 2004
  2. Eitan M

    pageLoad event on a frameset

    Eitan M, Jun 6, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    431
    Eitan M
    Jun 6, 2005
  3. =?Utf-8?B?TmVhbA==?=
    Replies:
    0
    Views:
    388
    =?Utf-8?B?TmVhbA==?=
    Jul 17, 2006
  4. sripathi
    Replies:
    0
    Views:
    935
    sripathi
    Jan 25, 2010
  5. Piotr

    Discovering what event was raised in PageLoad

    Piotr, Jan 9, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    117
    Piotr
    Jan 9, 2006
Loading...

Share This Page