protected ArrayList getChildControlsByType(Control c, string sType) { ArrayList controls = new ArrayList(); if (c != null) { if (c.GetType().ToString() == sType) { controls.Add(c); } else { foreach (Control c1 in c.Controls) { controls.AddRange(getChildControlsByType(c1, sType)); } } } return controls; }