Created
May 25, 2012 23:12
-
-
Save menacestudio/9d25efcd922662709eb7 to your computer and use it in GitHub Desktop.
ASP.NET - Recursive find control within a parent.
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 FindField(Control source, string id) | |
{ | |
Control target = source.FindControl(id); | |
if (target != null) return target; | |
foreach (Control child in source.Controls) | |
{ | |
target = this.FindField(child, id); | |
if (target != null) return target; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment