CreatingUser problem ... createuserwizard updating one field with another

howdy experts...

i am using the createuserwizard for a register page but have a small problem.  I want the userid to be an email address so i renamed the label for the username to email but left the id field as userid.  I then made the email field visible = false.

i want to call the CreatingUser method to set the email field to the username field before it processes but this doesnt seem to be happening as I look into the database and the user is created but the email for that user is blank.

ive tried to set it this way here plus tried using just CreateUserWizard1.Email =

right above this code i have a
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)

call that works just fine


protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
    {
        CreateUserWizard cuw = (CreateUserWizard)sender;
        cuw.Email = cuw.UserName;
    }

Open in new window

razzzzerAsked:
Who is Participating?
 
JimBrandleyConnect With a Mentor Commented:
Aha! You need to add a delegate if this isn't a custom class.

Jim
0
 
JimBrandleyCommented:
Try changing it to this:
protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
    {
        Createuserwizard1.Email = Createuserwizard1.UserName;
    }

Jim
0
 
razzzzerAuthor Commented:
that still doenst work... the email column in database is still empty... (
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
JimBrandleyCommented:
That doesn't make sense. Try this to see if we can learn anything:
protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
    {
        string name = Createuserwizard1.UserName;
        string startEmail = Createuserwizard1.Email;
        Createuserwizard1.Email = Createuserwizard1.UserName;
        string endEmail = Createuserwizard1.Email;

    }

Set a breakpoint in there to see what the results are.

Jim
0
 
razzzzerAuthor Commented:
i know it doesnt make sense )

the function right above it (created) works fine...
0
 
razzzzerAuthor Commented:
hmm if i did this correctly the breakpoints never halted the code so this function isnt being called.... do i have to tell the wizard to call it?  was under the impression that it would do so automatically....
0
 
JimBrandleyCommented:
Is this a delegate, or have you created a custom UserWizard class?

If it's a custom class, you would need to add:
base.CreatingUser( sender, e);

Otherwise, I'm out of ideas.

Jim
0
 
razzzzerAuthor Commented:
my bad... didnt have the oncreatinguser= set....

thanks!
0
 
JimBrandleyCommented:
Good! Glad that's fixed.

Jim
0
All Courses

From novice to tech pro — start learning today.