views:

235

answers:

0

OK, so I am having trouble with adding roles with the CreateUserWizard.

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" 
                Font-Size="Medium" 
                ContinueDestinationPageUrl="Default.aspx"
                LoginCreatedUser="False"
                DisableCreateUser="False"
                CompleteSuccessText="The account has been successfully created." 
                UnknownErrorMessage="The account was not created. Please try again."
                OnCreatedUser="CreateUserWizard1_CreatedUser">

......
<tr> 
                                        <td align="right">
                                            Role:
                                        </td>
                                        <td> 
                                        <asp:DropDownList
                                            ID="ddlUserRole" 
                                            runat="server" 
                                            DataSourceID="ObjectDataSource1"/>
                                        <asp:ObjectDataSource 
                                        ID="ObjectDataSource1" 
                                        runat="server" 
                                        SelectMethod="GetAllRoles" 
                                        TypeName="System.Web.Security.Roles"/>
                                        </td> 
                                    </tr>

...that's a small snippet. The Codebehind...

    using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class CreateUser : System.Web.UI.Page
{
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
        Roles.AddUserToRole(CreateUserWizard1.UserName.ToString(), ddlUserRole.SelectedItem.Text());
    }
}

It says that CreateUserWizard1 does not have the right context or w/e.

I should also say that...

I have a folder called Login where CreateUser.aspx is stored. The INHERITS is "Inherits="CreateUser". I don't get a compilation error for it, so it's finding it...