private void DvBind() { IGroupManage gmobj = GetInterface.GetIGroupManage(); IList <MR_Group> groupList = gmobj.GetList(); this.gvList.DataSource = groupList; this.gvList.DataBind(); }
/// <summary> /// 初始化权限组列表 /// </summary> /// <param name="bindIdList"></param> private void BindGroupList(bool bindIdList) { IGroupManage rgmobj = GetInterface.GetIGroupManage(); IList <MR_Group> groupList = rgmobj.GetList(); this.ddl_For.DataSource = groupList; this.ddl_For.DataTextField = "GName"; this.ddl_For.DataValueField = "GID"; this.ddl_For.DataBind(); //如果有传入页面ID string names = ""; string showids = ""; string span = ""; int searchCount = 0;//找到几个管理员ID会匹配 if (this.GroupIdList != string.Empty) { string[] idarr = this.GroupIdList.Split(','); foreach (MR_Group tmp in groupList) { if (Array.IndexOf(idarr, tmp.GID.ToString()) > -1) { names += span + tmp.GName; showids += span + tmp.GID.ToString(); span = ","; searchCount++; } } } //如果传入的ID能查找到管理员,添加一项, if (span == ",") { if (searchCount > 1) { this.ddl_For.Items.Add(new ListItem(names, showids)); } if (bindIdList) //如果默需要默认选择这一项 { this.ddl_For.SelectedValue = showids; } } }