以编程方式切换到 CreateUserWizard 控件中的 CompleteWizardStep

发布于 2024-08-22 13:02:04 字数 961 浏览 8 评论 0原文

如何以编程方式切换到 asp:CreateUserWizard 控件中 OnCreatingUser 事件中的 asp:CompleteWizardStep 步骤?

ASP.NET Web 表单

<asp:CreateUserWizard ID="MyCreateUserWizard" runat="server" OnCreatingUser="MyCreateUserWizard_CreatingUser">
    <WizardSteps>
        <asp:CreateUserWizardStep ID="CreateUserStep1" runat="server">
            <!-- code here -->
        </asp:CreateUserWizardStep>
        <asp:CompleteWizardStep ID="CompleteWizardStep" runat="server">
            <!-- code here -->
        </asp:CompleteWizardStep>
    </WizardSteps>
</asp:CreatedWizardStep>

隐藏代码

protected void MyCreateUserWizard_CreatingUser(object sender, EventArgs e)
{
    //retrieve username, password and email

    Membership.CreateUser(username, password, email);

    //would like to display the CompleteWizardStpe here

}

How do I programmatically switch to the asp:CompleteWizardStep step in the OnCreatingUser event in the asp:CreateUserWizard control?

ASP.NET web form

<asp:CreateUserWizard ID="MyCreateUserWizard" runat="server" OnCreatingUser="MyCreateUserWizard_CreatingUser">
    <WizardSteps>
        <asp:CreateUserWizardStep ID="CreateUserStep1" runat="server">
            <!-- code here -->
        </asp:CreateUserWizardStep>
        <asp:CompleteWizardStep ID="CompleteWizardStep" runat="server">
            <!-- code here -->
        </asp:CompleteWizardStep>
    </WizardSteps>
</asp:CreatedWizardStep>

Code behind

protected void MyCreateUserWizard_CreatingUser(object sender, EventArgs e)
{
    //retrieve username, password and email

    Membership.CreateUser(username, password, email);

    //would like to display the CompleteWizardStpe here

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

回忆躺在深渊里 2024-08-29 13:02:04
protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
{
    CreateUserWizard1.MoveTo(CompleteWizardStep1);
}
protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
{
    CreateUserWizard1.MoveTo(CompleteWizardStep1);
}
朱染 2024-08-29 13:02:04

我刚刚使用空的 OnCreatingUser 事件处理程序在 VS2008 / .net 3.5 中重新创建了您的解决方案,它“在我的计算机上运行”。那么,有什么不同可能导致这个问题呢?

aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default"
    Trace="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
    <form id="form1" runat="server">
    <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" OnCreatingUser="CreateUserWizard1_CreatingUser">
        <WizardSteps>
            <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
            </asp:CreateUserWizardStep>
            <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
            </asp:CompleteWizardStep>
        </WizardSteps>
    </asp:CreateUserWizard>
    </form>
</body>
</html>

代码隐藏:

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void CreateUserWizard1_CreatingUser(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
        {
        }
    }
}

web.config:

<authentication mode="Forms" />

其工作视频:http://www.screentoaster.com /watch/stWEJSR0ZIR19YRVleWV9QXlJX

I just recreated your solution in VS2008 / .net 3.5 using the empty OnCreatingUser event handler and it "works on my computer". So, what's different that could be causing this problem?

aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default"
    Trace="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
    <form id="form1" runat="server">
    <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" OnCreatingUser="CreateUserWizard1_CreatingUser">
        <WizardSteps>
            <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
            </asp:CreateUserWizardStep>
            <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
            </asp:CompleteWizardStep>
        </WizardSteps>
    </asp:CreateUserWizard>
    </form>
</body>
</html>

Code-behind:

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void CreateUserWizard1_CreatingUser(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
        {
        }
    }
}

web.config:

<authentication mode="Forms" />

Video of it working: http://www.screentoaster.com/watch/stWEJSR0ZIR19YRVleWV9QXlJX

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文