ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

All

yield all child controls recursivly

Source

public static class PageExtensions
{
    public static IEnumerable<Control> All(this ControlCollection controls)
    {
        foreach (Control control in controls)
        {
            foreach (Control grandChild in control.Controls.All())
                yield return grandChild;

            yield return control;
        }
    }
}

Example

todo

Author: David Findley

Submitted on: 21 aug. 2007

Language: C#

Type: System.Web.UI.ControlCollection

Views: 3913