Is there some generic method to find all server controls of a page in asp.net webforms?
I'm using this method to do that, but it is not finding the controls inside an asp:Repeater:
private void GetControlList<T>(ControlCollection controlCollection, List<T> resultCollection) where T : Control
{
foreach (Control control in controlCollection)
{
if (control is T)
resultCollection.Add((T)control);
if (control.HasControls())
GetControlList(control.Controls, resultCollection);
}
}
Thanks!