Hi everyone. I usually know how to solve this error but this time I am getting really frustrated.
I added a dropdownlist to the createNewUser wizard and I want to get at the selected value becuase it selects an existing role and I want to add the user to it. The problem is I am getting this error when I try to use the dropdownlist that I grabbed from the FindControl method.
Any idea why it says that?
HTML Code:
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
// get dropdown list from createNewUser control and add user to dept role that was selected
DropDownList DropDownListDept = (DropDownList)CreateUserWizard1.FindControl("DropDownListDept");
// just to test it but it produces and object not to instance error!!!
lbl1.Text = DropDownListDept.SelectedItem.Text;
Roles.AddUserToRole(CreateUserWizard1.UserName, DropDownListDept.SelectedItem.Text);
}