In case you have a Control container containing controls of different types, you may be interested in finding all controls of a specific type - this is what FindControls is for.
PlaceHolder phContainer = new PlaceHolder(); //imagine this PlaceHolder filled with controls List<RadioButton> rbtAnswers = Utils.Control.FindControls<RadioButton>(phContainer);
public static List<T> FindControls<T>(Control pParent) where T : Control { List<T> foundControls = new List<T>(); FindControls<T>(pParent, foundControls); return foundControls; } public static void FindControls<T>(Control pParent, List<T> pFoundControls) where T : Control { foreach (Control c in pParent.Controls) { if (c is T) { pFoundControls.Add((T)c); } else if (c.Controls.Count > 0) { FindControls<T>(c, pFoundControls); } } }
If you have a computer, you are managing links
Manylink allows you to :