Skip to content

Instantly share code, notes, and snippets.

@menacestudio
Created May 25, 2012 23:12
Show Gist options
  • Save menacestudio/9d25efcd922662709eb7 to your computer and use it in GitHub Desktop.
Save menacestudio/9d25efcd922662709eb7 to your computer and use it in GitHub Desktop.
ASP.NET - Recursive find control within a parent.
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