[英]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.