View Single Post
  #2 (permalink)  
Old March 8th, 2006, 03:28 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

You're close....

What you're trying to do is good: get a reference to the control. However, there are a few problems.

MobileNumber is indeed not a control, so you cannot assign a control to it. FindControl returns a generic control, and not a string. Once you have a reference to the control, you'll need to cast it to an appropriate control (e.g. DropDownList, TextBox etc) and then access a useful property, like the SelectedValue or the Text property:

CType(CreateUserWizard1.CreateUserStep.ContentTemp lateContainer.FindControl("MobileNumber"), TextBox).Text

This looks up the MobileNumber control, casts it to a TextBox and then gets its text.

Be aware that in the CreatedUser event the Profile object for the current user hasn't been setup yet. This normally happens early in the ASP.NET pipeline, but since you're working much later in the pipeline, the profile isn't there yet. However, you can programmatically create the profile object for the user and access it like this:

Dim myProfile As ProfileCommon = CType(ProfileCommon.Create(CreateUserWizard1.UserN ame, True), ProfileCommon)

The you can set the properties:

myProfile.MobileNumber = Mobile Number from earlier code.

You only need to do this in the page with the CreateUserWizard. Subsequent pages will have the correct Profile set up.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Why Go? by Faithless (Track 6 from the album: Sunday 8PM) What's This?