I have a web application that allows users to register with the website. I have used the default membership provider and I have enabled roles. I also used the default login page but I have added an extra step into it. I want the user to select whether they are a player or a coach.
Can anyone tell me why this code isn't working?
DropDownList role = (DropDownList)MemberType.ContentTemplateContainer.FindControl("DropDownList1"); string Role; Role = role.SelectedValue; if (Role=="Coach") { Roles.AddUserToRole(RegisterUser.UserName, "Coach"); Roles.AddUserToRole(RegisterUser.UserName, "Player"); } else { Roles.AddUserToRole(RegisterUser.UserName, Role); }
My dropdownlist's ID is 'DropDownList1'
This is my html stuff:
<%@ Page Title="Register" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
...
Go to the complete details ...