Customising the CreateUserWizard control

I wanted to add some code to my CreateUserWizard to enable the user to be assigned a role at the same time they were created but I ran into a snag. I added a radioButtonList with all the roles in to the createUserWizards template and then when I tried to add the user to the role in the CreatedUser sub I kept getting null exceptions :(

After a lenghty Google around I eventually discovered that it was because I was trying to find the radioButtonList in the CreateUserWizard when in fact I should have been looking for it in the createUserWizards ContentTemplateContainer.

This doesn't work:
Dim rblRole As RadioButtonList = CreateUserWizard1.FindControl("rblRole")
This works:
Dim rblRole As RadioButtonList = CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("rblRole") This is one of the "not very obvious" things that I waste hours of time on, so maybe I've saved you some.
Comments are closed