Exemplo n.º 1
0
        private void SetRolesState()
        {
            string userID = ddlAdmins.SelectedValue;

            string[] roles = AspnetMenu.GetRolesOfAdmin(userID);
            foreach (ListItem item in chkRolesList.Items)
            {
                item.Selected = false;
            }
            if (roles != null)
            {
                foreach (string role in roles)
                {
                    ListItem item = chkRolesList.Items.FindByValue(role);
                    if (item != null)
                    {
                        item.Selected = true;
                    }
                }
            }
        }
 /// <summary>
 /// 绑定角色列表
 /// </summary>
 private void BindRoleList()
 {
     ddlRoles.DataSource = AspnetMenu.GetRolesOfAdmin(Context.User.Identity.Name);
     ddlRoles.DataBind();
     ddlRoles.SelectedIndex = 0;
 }