private void BindData() { ConServer.TcAdminChkol tcAdminChkol = new ConServer.TcAdminChkol(); DataTable adminListTable = tcAdminChkol.GetAdminList(); IList <MR_Admin> oldAdminList = iamobj.GetList(); FilterOldAdmin(adminListTable, oldAdminList); adminList.DataSource = adminListTable; adminList.DataBind(); AdminPageStatic.RoleChecked(this); }
/// <summary> /// 初始化管理员列表 /// </summary> /// <param name="bindIdList"></param> private void BindAdminList(bool bindIdList) { IAdminManage iamobj = GetInterface.GetIAdminManage(); IList <MR_Admin> adminList = iamobj.GetList(); this.ddl_For.Items.Clear(); this.ddl_For.DataSource = adminList; this.ddl_For.DataTextField = "ANickName"; this.ddl_For.DataValueField = "AID"; this.ddl_For.DataBind(); //如果有传入页面ID string nicknames = ""; string showids = ""; string span = ""; int searchCount = 0;//找到几个管理员ID会匹配 if (this.AdminIdList != string.Empty) { string[] idarr = this.AdminIdList.Split(','); foreach (MR_Admin tmp in adminList) { if (Array.IndexOf(idarr, tmp.AID.ToString()) > -1) { nicknames += span + tmp.ANickName; showids += span + tmp.AID.ToString(); span = ","; searchCount++; } } } //如果传入的ID能查找到管理员,添加一项, if (span == ",") { if (searchCount > 1) { this.ddl_For.Items.Add(new ListItem(nicknames, showids)); } if (bindIdList) //如果默需要默认选择这一项 { this.ddl_For.SelectedValue = showids; } } }
private void DgBind() { IAdminManage iamobj = GetInterface.GetIAdminManage(); string keyword = this.tb_NickName.Text; IList <MR_Admin> adminList;// = iamobj.GetList(); if (NowAction == GetListAction.All) { adminList = iamobj.GetList(); } else if (keyword.ExistsSQLKeyChar()) { this.Alert("请填写中英文或数字,不要包含空格等特殊字符!"); return; } else { adminList = iamobj.GetListByNickName(keyword); } this.gvList.DataSource = adminList; this.gvList.DataBind(); }