This is a hairy one.
I have a situation in which the textbox.validating event fires when it
should not. The Text box is itself contained in a user control, which is
then loaded dynamically into a panel on a form. The form has some buttons on
it, some of which have CausesValidation set to True, and some of which have
CausesValidation set to false. The buttons themselves are on the form, not
inside the user control The User Control contains a required field validator
extender control as in the book "Developing Microsft .NET Controls with
Microsoft Visual Basic .NET." The Extender simply captures the Validating
event from the textbox and returns true if there is text in the box, and
false otherwise.
Given the way I have the control set up, the Validating Event for the
textbox should not be firing when I click a button with
CausesValidation=False. In fact, the Validating Event does NOT fire in this
scenario IF THE CONTROLS ARE ALL DIRECTLY ON THE FORM ITSELF. It's only in
this situation where the validation occurs inside the User Control that it's
an issue.
Any thoughts on what might be causing this?
Example:
TextBox contained in Form, Button contained in Form with
CausesValidation=False, TextBox.validating Event does not fire
Textbox contained in UserControl, Button contained in Form with
CausesValidation = False, TextBox.Validating Event does fire.
Thanks,
Chris McKenzie
Chris McKenzie - 27 Sep 2005 21:25 GMT
Okay, nevermind. I found the issue. The problem was that the button in the
latter case was itself contained in a panel, and the PANEL had
CausesValidation=True. Argh!
> This is a hairy one.
>
[quoted text clipped - 28 lines]
> Thanks,
> Chris McKenzie