Preventing RequiredFieldValidator(s) from functioning on a specified portion of a form.
Posted on 2005-05-13
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.
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...