I want to make use of the ootb ASP.NET2.0 MembershipProvider CreateUserWizard control, with a little customization to add a 2nd step.
The problem is that if my first step is type <asp:CreateUserWizardStep...>
and my 2nd is <asp:WizardStep...>
, the user is actually create imediately after the user clicks through from the first step and before they get to the second step.
here's the (very) basic control I'm using:
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
</asp:CreateUserWizardStep>
<asp:WizardStep runat="server" Title="License Step">
</asp:WizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
Is there anyway to tell the control to wait until all steps are complete before creating the user?
I had the same problem.
It seems that there is no other way to utilize the CreateUserWizard with the order that you want:
Step 1. User Creation
Step 2. License Step etc.
After CreateUserWizardStep the data will always be written to the database, unless you override the CreateUserWizard classes.
If you reverse the order of the steps it should work as published by Erich Peterson in 4GuysFromRolla website, i.e. Step 1. License Step, Step 2. ... Step 3. User Creation.
UPDATE:
I've found a relevant post which might help. In short:
If you want to prevent the CreateUserWizard's CreateUser step from creating the user, you can try to handle the CreatingUser event and set its LoginCancelEventArgs.Cancel property to true.
Example code:
protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
{
e.Cancel = true;
}
Then in order to move to the next page in the wizard you need to handle NextButtonClick event:
After that you will need to create the user manually, e.g. in FinishButtonClick event handler.
I haven't tried it yet but it should work. Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With