List<T> FindControls<T>(Control control) where T : Control { List<T> list = new List<T>(); foreach (Control c in control.Controls) { if (c is T) { Global.LogDebug(c.ID); list.Add(c as T); } list.AddRange(FindControls<T>(c)); } return list; } private Control FindControlRecursive(Control root, string id) { if (root.ID == id) { return root; } foreach (Control c in root.Controls) { Control t = FindControlRecursive(c, id); if (t != null) { return t; } } return null; }
Remember Me