/// <summary> /// 角色树数据绑定 /// </summary> /// <param name="idList">当前模块所有的角色ID</param> /// <returns>角色树数据</returns> public JsTreeCheck JsTreeRoleWithCheck(List <int> idList) { RoleBll bll = new RoleBll(); var roles = bll.GetAllRole(); JsTreeCheck jst = new JsTreeCheck(); jst.id = 0; jst.text = "全选"; List <JsTreeCheck> children = new List <JsTreeCheck>(); foreach (var role in roles) { State childState = new State(); if (idList.Contains(role.Id)) { childState.selected = true; } JsTreeCheck child = new JsTreeCheck() { id = role.Id, text = role.RoleName, state = childState }; children.Add(child); } jst.children = children; return(jst); }
protected void Page_Load(object sender, EventArgs e) { //判断是否重新进行请求 if (!IsPostBack) { //下拉框数据源 DropDownList_Roles.DataSource = roleBll.GetAllRole(); DropDownList_Roles.DataTextField = "RoleName"; DropDownList_Roles.DataValueField = "RoleID"; DropDownList_Roles.DataBind(); //查询 SearchUsers(); } }