Problem with Roles.GetUsersInRole

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Hi All:
I have a page where the managers can maintain their own users -
GridView is populated with the list of users. When the manager adds a
new user (button click event calls Roles.AddUserToRole) the subsequent
call to Roles.GetUsersInRole is not returning the user just added. It
is returning a string[], but without the one. Is there a way to force
a refresh of the provider?
-Bob
 
Hi All:
I have a page where the managers can maintain their own users -
GridView is populated with the list of users. When the manager adds a
new user (button click event calls Roles.AddUserToRole) the subsequent
call to Roles.GetUsersInRole is not returning the user just added. It
is returning a string[], but without the one. Is there a way to force
a refresh of the provider?
-Bob

Is the subsequent call in the same request?

Where are you calling Roles.GetUsersInRole from? what event?
Peter Kellner
http://peterkellner.net
 
Hello Peter:
Thanks for responding. Below is a snippet of my code.

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DropDownListRoles.DataSource = Roles.GetAllRoles();
DropDownListRoles.DataBind();
}
GridView1.DataSourceID = null;
GridView1.DataSource = GetCurrentUsers();
GridView1.DataBind();
}

protected void btnAddUser_Click(object sender, EventArgs e)
{
if(!Roles.IsUserInRole(DropDownListUsers.SelectedValue,
DropDownListRoles.SelectedValue))
Roles.AddUserToRole(DropDownListUsers.SelectedValue,
DropDownListRoles.SelectedValue);
}
 
Back
Top