How do I prevent the validators firing when a button is clicked?

Discussion in 'ASP .Net' started by Alan Silver, Jul 20, 2005.

  1. Alan Silver

    Alan Silver Guest

    Hello,

    I have a page with some validators, all of which work fine. I want to
    add a Cancel button to the page, so that if the user decides not to fill
    in the form, they can click Cancel and go back to where they were
    before.

    Trouble is that clicking the Cancel button fires the validators and
    stops the page being submitted. How can I get around this?

    TIA

    --
    Alan Silver
    (anything added below this line is nothing to do with me)
     
    Alan Silver, Jul 20, 2005
    #1
    1. Advertising

  2. Alan Silver

    Hans Kesting Guest

    Alan Silver wrote:
    > Hello,
    >
    > I have a page with some validators, all of which work fine. I want to
    > add a Cancel button to the page, so that if the user decides not to
    > fill in the form, they can click Cancel and go back to where they were
    > before.
    >
    > Trouble is that clicking the Cancel button fires the validators and
    > stops the page being submitted. How can I get around this?
    >
    > TIA


    The button has a CausesValidation property that is default "true" ...

    Hans Kesting
     
    Hans Kesting, Jul 20, 2005
    #2
    1. Advertising

  3. Alan Silver

    Alan Silver Guest

    <snip>
    >> Trouble is that clicking the Cancel button fires the validators and
    >> stops the page being submitted. How can I get around this?

    >
    >The button has a CausesValidation property that is default "true" ...


    Thanks for the fast and accurate response. I'm sure Ill get the hang of
    all this one day ;-)

    --
    Alan Silver
    (anything added below this line is nothing to do with me)
     
    Alan Silver, Jul 20, 2005
    #3
  4. Re: How do I prevent the validators firing when a button is clicke

    In ASP.Net 2.0. you have also ValidateGroup property which specifies group of
    controls affected by validation.


    --
    C# Dev


    "Alan Silver" wrote:

    > <snip>
    > >> Trouble is that clicking the Cancel button fires the validators and
    > >> stops the page being submitted. How can I get around this?

    > >
    > >The button has a CausesValidation property that is default "true" ...

    >
    > Thanks for the fast and accurate response. I'm sure Ill get the hang of
    > all this one day ;-)
    >
    > --
    > Alan Silver
    > (anything added below this line is nothing to do with me)
    >
     
    =?Utf-8?B?SmFjZWsgU3Rhd2lja2k=?=, Jul 20, 2005
    #4
  5. Alan Silver

    Alan Silver Guest

    Re: How do I prevent the validators firing when a button is clicke

    >In ASP.Net 2.0. you have also ValidateGroup property which specifies group of
    >controls affected by validation.


    Yeah, and I've wished that was in 1.1 a few times!! I hope they get 2.0
    out of beta soon, there are so many new features I would like to use,
    but I'm not putting a beta version on a production server!!

    Thanks for the reply

    --
    Alan Silver
    (anything added below this line is nothing to do with me)
     
    Alan Silver, Jul 20, 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. Stan
    Replies:
    1
    Views:
    1,780
    Tomasz Kaszuba
    Jun 30, 2003
  2. Ratman
    Replies:
    0
    Views:
    664
    Ratman
    Sep 14, 2004
  3. Mossman
    Replies:
    0
    Views:
    793
    Mossman
    Dec 12, 2005
  4. bill
    Replies:
    11
    Views:
    734
    addup
    Jul 21, 2006
  5. APA
    Replies:
    2
    Views:
    669
Loading...

Share This Page