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

  • Thread starter Thread starter Alan Silver
  • Start date Start date
A

Alan Silver

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 said:
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
 
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 ;-)
 
In ASP.Net 2.0. you have also ValidateGroup property which specifies group of
controls affected by validation.
 
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
 
Back
Top