private void GetErrorValidators_Helper(Control parent, ArrayList errorValidators)
        {
            foreach (Control control in parent.Controls)
            {
                BaseValidator baseVal = control as BaseValidator;
                if (baseVal != null && baseVal.ErrorMessage.Length != 0)
                {
                    if (_callValidate)
                    {
                        baseVal.Validate();
                    }

                    if (!baseVal.IsValid)
                    {
                        errorValidators.Add(baseVal);
                    }
                }
                GetErrorValidators_Helper(control, errorValidators);
            }
        }
        protected virtual Object [] GetValidatableControls(Object instance)
        {
            System.Web.UI.MobileControls.BaseValidator thisValidator = null;

            if (instance is Array)
            {
                Array controlList = (Array)instance;
                Debug.Assert(controlList.Length > 0);

                thisValidator = (BaseValidator)controlList.GetValue(0);
                Form firstForm = GetContainingForm(thisValidator);

                for (int i = 1; i < controlList.Length; i++)
                {
                    BaseValidator validator = (BaseValidator)controlList.GetValue(i);
                    if (GetContainingForm(validator) != firstForm)
                    {
                        return(null);
                    }
                }
            }

            if (instance is System.Web.UI.MobileControls.BaseValidator)
            {
                thisValidator = (System.Web.UI.MobileControls.BaseValidator)instance;
            }
            else if (instance is ChoicePropertyFilter)
            {
                IDeviceSpecificDesigner designer =
                    ((ChoicePropertyFilter)instance).Designer;

                thisValidator = designer.UnderlyingObject
                                as System.Web.UI.MobileControls.BaseValidator;
            }

            if (thisValidator == null)
            {
                Debug.Fail("Unsupported object passed in");
                return(null);
            }

            ArrayList controlArray = new ArrayList();

            if (GetContainingStyleSheet(thisValidator) != null)
            {
                ISite      site      = thisValidator.Site;
                IContainer container = null;

                if (site != null)
                {
                    container = site.Container;
                    Debug.Assert(container != null);

                    foreach (IComponent component in container.Components)
                    {
                        Control control = component as Control;
                        if (control != null && CanBeValidated(control))
                        {
                            controlArray.Add(control.ID);
                        }
                    }
                }
            }
            else
            {
                Form parentForm = GetContainingForm(thisValidator);

                if (parentForm != null)
                {
                    ExtractValidatableControls(parentForm, controlArray);
                }
                else
                {
                    return(null);
                }
            }

            controlArray.Sort();
            return(controlArray.ToArray());
        }
 public DesignerValidatorAdapter(BaseValidator baseValidator)
 {
     base.set_Control(baseValidator);
 }