Last post Feb 19, 2010 01:05 PM by pjlyons
Feb 18, 2010 04:24 PM|pjlyons|LINK
I have a nested user control, one user control inside another user control.
The top level user control has the button that causes validation and the validation works for the validators in this control.
The child user control's validators are not hit on the button click.
I'm currently using a ValidatorGroup on all the controls in both user controls because I have used this before and it has worked.
I am creating both User Controls Dynamically OnLoad of each control. The child user control is added to the parent user control on the OnLoad of the parent control then on the OnLoad of the child control its fields and validators are built.
Thanks in advance for your help,
Feb 18, 2010 05:56 PM|Prof_Teancum|LINK
So what is the actual problem. It sounds like it should work ok. As long as the validationGroup property is set the same for all the validators they should all fire (unless they are set to invisible on pageLoad).
Feb 19, 2010 12:28 PM|pjlyons|LINK
The issue is that the controls in the child control do not fire, only the controls in the parent do.
I'll check to make sure the validators aren't set to invisible onload.
Feb 19, 2010 12:45 PM|pjlyons|LINK
The validators are enabled and set to visible.
Feb 19, 2010 01:05 PM|pjlyons|LINK
My issue was because I incorrectly was using the initial value attribute of Validator. I was setting the initial value of the child control validators to 0. (i.e. Validator.InitialValue = "0")
When I removed these initial values my validators were then hit.
The cases that I have ran into where you need to set the initial value of a validator to 0 is when the control to validate is a dropdownlist.