private void DisplayUsersBelongingToRole() { string selectedRoleName = RoleList.SelectedValue; string[] usersBelongingToRole = Roles.GetUsersInRole(selectedRoleName); RolesUserList.DataSource = usersBelongingToRole; RolesUserList.DataBind(); }
private void DisplayUsersBelongingToRole() { // Get the selected role string selectedRoleName = RoleList.SelectedValue; // Get the list of usernames that belong to the role string[] usersBelongingToRole = Roles.GetUsersInRole(selectedRoleName); // Bind the list of users to the GridView RolesUserList.DataSource = usersBelongingToRole; RolesUserList.DataBind(); }
private void DisplayUsersBelongingToRole() { // Get the selected role string selectedRoleName = RoleList.SelectedValue; // Get the list of usernames that belong to the role string[] usersBelongingToRole = RoleManager.FindByName(selectedRoleName).Users.Select(u => UserManager.FindById(u.UserId).UserName).ToArray(); // Bind the list of users to the GridView RolesUserList.DataSource = usersBelongingToRole; RolesUserList.DataBind(); }