This is a recursive function to get all child controls under the target control.
Source
public static IEnumerable<Control> GetChildren(this Control control)
{
var children = control.Controls.Cast<Control>();
return children.SelectMany(GetChildren).Concat(children);
}
Example
IEnumerable<Control> children = Page.GetChildren();
or
IEnumerable<Control> children = Container.GetChildren();