Idrees Khan
Idrees Khan

Reputation: 7752

How to handle CreateUserWizard Steps in Asp.Net?

I have used asp.net creatuserwizard in my project. And my custom template looks like this

<WizardSteps>
    <asp:CreateUserWizardStep ID="CreateUserWizardStep0" runat="server">
        <ContentTemplate>
          //my custom code is here
        </ContentTemplate>
        <CustomNavigationTemplate>
        </CustomNavigationTemplate>
    </asp:CreateUserWizardStep>

Now, in Step2 i have code like this;

 <asp:WizardStep ID="CreateUserWizardStep1" runat="server" AllowReturn="False"             StepType="Step">
        <div class="accountInfo">
            <fieldset class="register">
                   <p>
                        <asp:Label ID="CityLabel" runat="server" AssociatedControlID="City">City:</asp:Label>
                        <asp:TextBox ID="City" runat="server" CssClass="textEntry"></asp:TextBox>
                    </p>
                    <p>
                        <asp:Label ID="CountryLabel" runat="server" AssociatedControlID="Country">Country:</asp:Label>
                        <asp:TextBox ID="Country" runat="server" CssClass="textEntry"></asp:TextBox>
                    </p>

            </fieldset>
        </div>
    </asp:WizardStep>

So, my question is, how do i insert 'City' textbox value in my user profile as i click on next in step2.

Upvotes: 1

Views: 1093

Answers (2)

coseguera
coseguera

Reputation: 116

You can handle the NextButtonClick of the Create User Wizard and check for the currentstepindex:

    protected void YourCreateUserWizard_NextButtonClick(object sender, WizardNavigationEventArgs e)
    {
        if (e.CurrentStepIndex == YourStepIndex)
        {
            ...
        }
    }

Upvotes: 1

ntziolis
ntziolis

Reputation: 10221

You will need to add code to handle the CreatedUser event of the wizard control.

This part should be in the code behind, there you have access to the current state of the wizard:

protected void CreateUserWizard_CreatedUser(object sender, EventArgs e)
{
  // Finde the value
  var cityField = (TextBox)CreateUserWizard.CreateUserWizardStep1.FindControl("City");

  // use the field value todo whatever you want    
}

Upvotes: 0

Related Questions