I have a complex asp.net form,having even 50 to 60 fields in one form like there is Multiview
, inside MultiView I have a GridView
, and inside GridV
Late as usual. If anyone is still interested in this there are a number of related SO questions and answers. My version of recursive extension method for resolving this:
public static IEnumerable FindControlsOfType(this Control parent)
where T : Control
{
foreach (Control child in parent.Controls)
{
if (child is T)
{
yield return (T)child;
}
else if (child.Controls.Count > 0)
{
foreach (T grandChild in child.FindControlsOfType())
{
yield return grandChild;
}
}
}
}