Recursive Goodness - II

Find a control within a control recursively:

protected void Control FindControlRecursive(Control Root, string Id)
{
    if (Root.ID == Id)
    return Root;
    foreach (Control Ctl in Root.Controls)
    {
        Control FoundCtl = FindControlRecursive(Ctl, Id);
        if (FoundCtl != null)
        return FoundCtl;
    }
    return null;
}
If you liked this post, 🗞 subscribe to my newsletter and follow me on 𝕏!