简体   繁体   English

如何处理Asp.Net中的CreateUserWizard步骤?

[英]How to handle CreateUserWizard Steps in Asp.Net?

I have used asp.net creatuserwizard in my project. 我在项目中使用过asp.net creatuserwizard。 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; 现在,在Step2中,我有这样的代码;

 <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. 因此,我的问题是,当我在步骤2中单击下一步时,如何在用户个人资料中插入“城市”文本框值。

You can handle the NextButtonClick of the Create User Wizard and check for the currentstepindex: 您可以处理“创建用户向导”的NextButtonClick并检查currentstepindex:

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

You will need to add code to handle the CreatedUser event of the wizard control. 您将需要添加代码来处理向导控件的CreatedUser事件。

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    
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 自定义ASP.NET CreateUserWizard中DropDownList的问题 - Problemswith DropDownList in customized ASP.NET CreateUserWizard 在ASP.NET MVC 2中使用Profile和CreateUserwizard - Using Profile and CreateUserwizard in ASP.NET MVC 2 CreateUserWizard数据库访问Asp.Net - CreateUserWizard Database Access Asp.Net 如何在ASP.Net CreateUserWizard中获取新注册用户的用户ID? - How do I get User ID for new registered user in ASP.Net CreateUserWizard? 在ASP.NET中添加用户之前,如何验证用户条目-CreateUserWizard - how to Validate user entries, before adding the user in ASP.NET - CreateUserWizard 如何防止在createuserwizard控件中更改用户名字段。 asp.net - How to prevent username field from being changed in the createuserwizard control. asp.net asp.net + ddl SelectedIndexChanged没有在CreateUserWizard内容模板中触发 - asp.net + ddl SelectedIndexChanged not firing inside CreateUserWizard Content template ASP.Net CreateUserWizard中的当前上下文中不存在控件 - Controls does not exist in current context in ASP.Net CreateUserWizard 首次使用createuserwizard组件的ASP.NET - ASP.NET first time using createuserwizard component 是否有必要在ASP.NET CreateUserWizard控件中使用电子邮件字段? - Is it necessary to have Email field in ASP.NET CreateUserWizard Control?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM