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

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top