1

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

ASP.NET 网络表单

<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

}
4

2 回答 2

0
protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
{
    CreateUserWizard1.MoveTo(CompleteWizardStep1);
}
于 2010-03-01T17:48:11.353 回答
0

我刚刚使用空的 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)
        {
        }
    }
}

网络配置:

<authentication mode="Forms" />

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

于 2010-03-02T15:08:49.483 回答