Adding user to Role (ASP.NET)

Capodecina
Permabanned
Joined
31 Dec 2003
Posts
5,172
Location
Barrow-In-Furness
At the moment I have a page with a drop down menu which populates with a list of users and allows me to display their roles.

Below that I have another drop down menu which populates with a list of all available roles, and a button which should allow me to add the user selected to that role. The problem being that it doesn't work...

Here's the code:

Code:
Partial Class Management_Roles
    Inherits System.Web.UI.Page


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        GridView1.DataSource = Roles.GetRolesForUser(DropDownList1.SelectedValue)
        GridView1.DataBind()
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        DropDown2DataBind()
    End Sub

    Protected Sub DropDown2DataBind()
        DropDownList2.DataSource = Roles.GetAllRoles()
        DropDownList2.DataBind()
    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        [COLOR="Red"][B]Roles.AddUserToRole(DropDownList1.SelectedItem.ToString(), DropDownList2.SelectedItem.ToString())[/B]  [/COLOR]  
     End Sub


End Class

I've highlighted the line that my program stops on. It simply says that the user is already part of the first role in the drop down menu, not the role I have actually selected.

Any ideas?
 
Back
Top Bottom