protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // Reference the SpecifyRolesStep WizardStep WizardStep SpecifyRolesStep = RegisterUserWithRoles.FindControl("SpecifyRolesStep") as WizardStep; // Reference the RoleList CheckBoxList CheckBoxList RoleList = SpecifyRolesStep.FindControl("RoleList") as CheckBoxList; // Bind the set of roles to RoleList RoleList.DataSource = Roles.GetAllRoles(); RoleList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // Reference the SpecifyRolesStep WizardStep WizardStep SpecifyRolesStep = RegisterUserWithRoles.FindControl("SpecifyRolesStep") as WizardStep; // Reference the RoleList CheckBoxList DropDownList RoleList = SpecifyRolesStep.FindControl("RoleList") as DropDownList; // Bind the set of roles to RoleList RoleList.Items.Add(new ListItem("Basic 99kr/month", "Basic")); RoleList.Items.Add(new ListItem("Plus 199kr/month", "Plus")); RoleList.Items.Add(new ListItem("Prime 499kr/month", "Prime")); RoleList.DataBind(); } }
protected void RegisterUserWithRoles_ActiveStepChanged(object sender, EventArgs e) { // Have we JUST reached the Complete step? if (RegisterUserWithRoles.ActiveStep.Title == "Complete") { // Reference the SpecifyRolesStep WizardStep WizardStep SpecifyRolesStep = RegisterUserWithRoles.FindControl("SpecifyRolesStep") as WizardStep; // Reference the RoleList CheckBoxList CheckBoxList RoleList = SpecifyRolesStep.FindControl("RoleList") as CheckBoxList; // Add the checked roles to the just-added user foreach (ListItem li in RoleList.Items) { if (li.Selected) { Roles.AddUserToRole(RegisterUserWithRoles.UserName, li.Text); } } } }