FindControl<T>

public static T FindControl<T>( this Control startingControl, string id) where T : Control
{
    T foundControl = default(T);

    int controlCount = startingControl.Controls.Count;

    foreach (Control c in startingControl.Controls)
    {
        if (c is T && string.Equals(id, c.ID, 
            StringComparison.InvariantCultureIgnoreCase))
        {
            foundControl = c as T;
            break;
        }
        else
        {
            foundControl = FindControl<T>(c, id);
            if (foundControl != null)
            {
                break;
            }
        }
    }
    return foundControl;
}
Example:
Button UpdateButton = Page.FindControl<Button>("UpdateButton");

Description

Generic recursive FindControl.

Details

Double click on the code to select all.

 

;