Object reference not set to an instance of an object and ceate userwizard

F

Fendi Baba

I customised the creare user wizard and added a Listbox on the page.
The listbox is populated by a dataset when the page is loaded. When I
try to submit i get an error. This error is due to the list box. Any
ideas why this may be so? The listbox is not added between the
CreateUserWizardStep.


this is the code in the submit button

Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
CreateUserWizard1.CreatedUser

Dim CheckBoxRoles As ListBox = _

CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("CheckBoxRoles"),
ListBox)
Dim role_indices As Integer = CheckBoxRoles.GetSelectedIndices

Dim rolesList(role_indices.Length - 1) As String

For i As Integer = 0 To rolesList.Length - 1
rolesList(i) = Me.CheckBoxRoles.SelectedItem.Value

Next
Roles.AddUserToRoles(CreateUserWizard1.UserName.ToString,
rolesList)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top