CreateUserWizard step changing issue after account creation

走远了吗. 提交于 2019-12-11 08:48:28

问题


I want to change the createuserwizard.step= start if the mail sending fails and not to go to successful creation step.

                 catch (SmtpException ex)
    {
       Membership.DeleteUser(textboxemail.Text.Trim());
       Literal errorMessage=(Literal) CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ErrorMessage");
       errorMessage.Text = "Account creation failed due to email notification."+ ex.Message + " errorcode" +ex.StatusCode + "; inner exception; " + ex.InnerException;
       CreateUserWizard1.CreateUserStep.StepType = WizardStepType.Start;
    }

but the exception says the steptype can't be changed. So how to do this. I mean to stop from going to success step.


回答1:


You are getting that exception because you need to use the Wizard.MoveTo method.

Like this:

CreateUserWizard1.MoveTo(WizardStep1);

Where "WizardStep1" is the ID of the asp:WizardStep that you want to go back to (the "start" step).



来源:https://stackoverflow.com/questions/17424845/createuserwizard-step-changing-issue-after-account-creation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!