Hi (I\'m pretty new to this),
Is it possible to add roles to the \'CreateUserWizard\' tool so that you tick boxes (or view roles in a drop down menu) and once one or
Add the dropdownlist under the last textbox of the CreateUserWizard as the following code shows. ASP:
<%---------existing items------------%>
Security Answer:
*
<%---------role Dropdownlist to be inserted here------------%>
Role
Also you have to add in behind code the following:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RoleDropDownList")).DataSource = Roles.GetAllRoles();
((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RoleDropDownList")).DataBind( );
int rolecounter = ((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RoleDropDownList")).Items.Count;
((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RoleDropDownList")).Items[rolecounter - rolecounter].Selected = true;
}
}
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
DropDownList roleDropDownList = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RoleDropDownList");
Roles.AddUserToRole(CreateUserWizard1.UserName, roleDropDownList.SelectedValue);
}
This is working for me.Check it
see for more there http://p2p.wrox.com/asp-net-2-0-basics/42303-createuserwizard-dropdownlist.html