Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > CausesValidation not working as expected.
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 26th February 02:39
chris mckenzie
External User
 
Posts: 1
Default CausesValidation not working as expected.


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
  Reply With Quote


  sponsored links


2 26th February 02:39
chris mckenzie
External User
 
Posts: 1
Default CausesValidation not working as expected.


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!
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666