protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { lb_err.Text = ""; CY.CYWebsite.Core.Business.Web_Manager manager = new CY.CYWebsite.Core.Business.Web_Manager(); List<CY.CYWebsite.Core.Business.Web_Manager> listManager = manager.GetAllList() as List<CY.CYWebsite.Core.Business.Web_Manager>; ddl_Manager.DataSource = listManager; ddl_Manager.DataTextField = "Manage_RealName"; ddl_Manager.DataValueField = "Manager_Code"; ddl_Manager.DataBind(); ddl_Manager.Items.Insert(0, new ListItem("全部", "")); ddl_Manager.Items.Insert(ddl_Manager.Items.Count, new ListItem("已删除", "已删除")); Bind(); } catch (Exception ex) { lb_err.Text = ex.Message; } } }
private void Bind() { CY.CYWebsite.Core.Business.Web_Manager manager; IList<CY.CYWebsite.Core.Business.Web_Manager> list; if (textSearch.Text.Trim() == string.Empty) { manager = new CY.CYWebsite.Core.Business.Web_Manager(); list = manager.GetAllList(); } else { manager=new CY.CYWebsite.Core.Business.Web_Manager(); string name = textSearch.Text.Trim(); list =manager.GetSearchByName(name); } gvManager.DataSource = list; gvManager.DataBind(); }