using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; using System.Web.UI; namespace Ant.Frame { public static class GetValue { public static T GetControlValue(Control page, T enty) { List conlist = new List(); foreach (Control ctrol in page.Controls) { conlist.Add(ctrol); } return GetCollection(conlist, enty, ""); } public static T GetControlValue(Control page, T enty, string lbl) { List conlist = new List(); foreach (Control ctrol in page.Controls) { conlist.Add(ctrol); } return GetCollection(conlist, enty, lbl); } /// ///不知道控件的级次进行赋值 /// /// /// public static T GetControlValue(List pages, T enty) { return GetCollection(pages, enty, ""); } private static T GetCollection(List page, T enty, string lbl) { int level = 0; return ControlCollection(page, level, enty, lbl); } private static T ControlCollection(List oldMenus, int level, T entity, string lbl) { foreach (Control menu in oldMenus) { SelectControl con = new SelectControl(ControlType.Ext, menu); entity = con.GetResult(entity, lbl); int controlnum = menu.Controls.Count; if (controlnum == 0) level++; else { List conlist = new List(); foreach (Control ctrol in menu.Controls) { conlist.Add(ctrol); } ControlCollection(conlist, level, entity, lbl); } } return entity; } } }