//获取所有dropdownlist类型的控件放到list中 Listlist2=GetControls(this.Controls, typeof(DropDownList)); //对page下的所有子控件的子控件进行循环遍历,获取dropdownlist类型控件 private List GetControls(System.Web.UI.ControlCollection ctrls, Type type) { List list = new List (); foreach (System.Web.UI.Control ctrl in ctrls) { if (ctrl.GetType() == type) { list.Add(ctrl); } if (ctrl.Controls.Count > 0) { foreach (Control con in GetControls(ctrl.Controls, type)) { list.Add(con); } } } return list; }