0
我想允許用戶從包含所有角色的下拉列表中選擇createuserwizard上的角色。我不會收到錯誤,但是無論選擇了什麼dropdownlist項目,用戶總是會添加到「Offering Rooms」角色。用戶被添加到1個角色(asp.net成員資格)
代碼:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
roleDropDownList = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("RoleDropDownList")
roleDropDownList.DataSource = Roles.GetAllRoles()
roleDropDownList.DataBind()
End Sub
Protected Sub RegisterUser_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles RegisterUser.CreatedUser
Roles.AddUserToRole(RegisterUser.UserName, roleDropDownList.SelectedValue)
End Sub
標記:
<asp:DropDownList ID="RoleDropDownList" runat="server">
</asp:DropDownList>
HTML:
<option value="Offering Rooms">Offering Rooms</option>
<option value="Seeking Rooms">Seeking Rooms</option>