protected function ValidateControlAndChildren(QControl $objControl) { // Initially Assume Validation is True $blnToReturn = true; // Check the Control Itself if (!$objControl->Validate()) { $objControl->MarkAsModified(); $blnToReturn = false; } // Recursive call on Child Controls foreach ($objControl->GetChildControls() as $objChildControl) { // Only Enabled and Visible and Rendered controls should be validated if ($objChildControl->Visible && $objChildControl->Enabled && $objChildControl->RenderMethod && $objChildControl->OnPage) { if (!$this->ValidateControlAndChildren($objChildControl)) { $blnToReturn = false; } } } return $blnToReturn; }