Recursive Goodness - I

Check to see if all the controls within a specific control are valid:

protected bool checkIsValid(Control c)
{
    bool result = true;
    foreach (Control child in c.Controls)
    {

        if (child is BaseValidator && !((IValidator)child).IsValid)
        {
            return false;
        }
        result = result & checkIsValid(child);
    }
    return result;
}
If you liked this post, 🗞 subscribe to my newsletter and follow me on 𝕏!