It sounds like you need the feature called "validation groups" which is
coming in ASP.NET 2.0 (due in Spring of 2005 and available today in Beta 1
from Microsoft). This allows you to assign a group name to each button and
the validators it fires.
Without it, you have to use a different strategy that abandons client-side
validation. Someone recommended a customvalidator. I
recommend in the Click event for each button, call the Validate() method on
individual validators that are involved. Then test each validator's own
IsValid property and continue if all are true.
I offer a commercial solution for this problem that provides validation
groups and works fully on the client side: "Professional Validation And
More" (
http://www.peterblum.com/vam/home.aspx).
There are many limitations in Microsoft's validator controls. I've put
together a list of them at
http://www.peterblum.com/vam/valmain.aspx to help
people plan their validation designs.
--- Peter Blum
www.PeterBlum.com
Email:
PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Mad Scientist Jr" <us*************@yahoo.com> wrote in message
news:7a**************************@posting.google.c om...
To use a simple example, if I have a web form with two textboxes
Textbox1 and Textbox2, two Required Field Validators Validator1 (which
validates Textbox1) and Validator2 (for Textbox2), and two buttons
Button1 and Button2, can I specify that Validator1 should only
validate if Button1 is pressed, and Validator2 should only validate if
Button2 is pressed? If Button2 is pressed, we do not need Textbox1,
and if Button1 is pressed we do not need Textbox2. Note this is a
simlified example, it would not be possible to just have Textbox1 and
two buttons - in actuality there are many textboxes, each with
validators for data type and range as well as required fields, and
many buttons. I just want to know if this kind of thing is possible or
what is done in such a case. Currently validation is done in the
codebehind. Thanks.