Created
September 16, 2012 04:39
-
-
Save evancummings/3731015 to your computer and use it in GitHub Desktop.
Finds a control at any depth in the provided container's heirarchy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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