Link to home
Start Free TrialLog in
Avatar of mpp1031
mpp1031

asked on

Preventing RequiredFieldValidator(s) from functioning on a specified portion of a form.

I have a page that has two "sections" (ASP.Net panels > > which render as HTML <DIV> blocks, anyway...).

One section is a "Login" section for existing users to login.  The other section is for new users to register (i.e. enter their name and create a password).

I've got required field validators on all my text boxes on the page.  However, there are two buttons:  one that fires the Logon routine, and the other that fires the Register routine.   By necessity, each button's CausesValidation property is TRUE.  What happens is that clicking either one of the buttons fires the validators for the whole page.

What I want is for the Login section's validators to "validate" only when the Login button has been clicked, and vice versa.  I would prefer to do all of the coding server-side in the code-behind and avoid JavaScript on this.

I've searched EE a bit on this already, but could find nothing that I liked (or even really addressed this type of issue).

My thought is that there ought to be a way to make the btnLogon_Click event's code "ignore" the other set of field validators.

The other idea that (I think) I understood from another EE post is to cause the validation to fire manually (make the buttons' CausesValidation property FALSE and raise the validation event elsewhere in the codebehind when I want it).  I'm not too crunk on how that ought to go down...
ASKER CERTIFIED SOLUTION
Avatar of raterus
raterus
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mpp1031
mpp1031

ASKER

Thanks, raterus.  That's essentially what I decided to do. ( btnLogin CausesValidation = false ).  Thanks for the help.