Power BI

Content by Charles Sterling

Modifying the CreateUserWizard Control to Capture Additional Data


I needed a fast way of capturing some user data and started playing with the CreateUserWizard control to do this work for me…Turns out the hardest part was referencing the events and controls i have added.

There is a help file on the topic of the referencing but thought a simplified version might be helpful.  Below please find the code i am using to dump the additional personal data into the “comments” property (field) of the membershipuser object.



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

Dim user As MembershipUser = Membership.GetUser(CreateUserWizard1.UserName)

Dim fNameTextBox As TextBox = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl(“fname”), TextBox)
Dim lNameTextBox As TextBox = CTypeEE(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl(“lname”), TextBox)
Dim cityBox As TextBox = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl(“city”), TextBox)
Dim stateTextBox As TextBox = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl(“state”), TextBox)
Dim postTextBox As TextBox = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl(“post”), TextBox)
Dim countryTextBox As TextBox = CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl(“country”), TextBox)

user.Comment = fNameTextBox.Text
user.Comment = user.Comment + vbTab + fNameTextBox.Text
user.Comment = user.Comment + vbTab + lNameTextBox.Text
user.Comment = user.Comment + vbTab + cityBox.Text
user.Comment = user.Comment + vbTab + stateTextBox.Text
user.Comment = user.Comment + vbTab + postTextBox.Text
user.Comment = user.Comment + vbTab + countryTextBox.Text


End Sub