Skip to content

Instantly share code, notes, and snippets.

@evancummings
Created September 16, 2012 04:39
Show Gist options
  • Select an option

  • Save evancummings/3731015 to your computer and use it in GitHub Desktop.

Select an option

Save evancummings/3731015 to your computer and use it in GitHub Desktop.
Finds a control at any depth in the provided container's heirarchy
private Control FindControlRecursive(Control root, string id)
{
if (root.ID == id)
{
return root;
}
foreach (Control c in root.Controls)
{
Control t = FindControlRecursive(c, id);
if (t != null)
{
return t;
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment