如何处理Asp.Net中的CreateUserWizard步骤?
问题描述:
我在我的项目中使用了asp.net creatuserwizard。我的自定义模板看起来像这样如何处理Asp.Net中的CreateUserWizard步骤?
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep0" runat="server">
<ContentTemplate>
//my custom code is here
</ContentTemplate>
<CustomNavigationTemplate>
</CustomNavigationTemplate>
</asp:CreateUserWizardStep>
现在,在步骤2我有这样的代码;
<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>
所以,我的问题是,如何插入我的用户配置文件“城市”文本框的值,因为我在接下来的第二步点击。
答
您可以处理创建用户向导的NextButtonClick并检查currentstepindex:
protected void YourCreateUserWizard_NextButtonClick(object sender, WizardNavigationEventArgs e)
{
if (e.CurrentStepIndex == YourStepIndex)
{
...
}
}
答
您将需要添加代码来处理向导控件的CreatedUser
事件。
这部分应该是在后面的代码,有你有机会获得精灵的当前状态:
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
}
+0
的代码我也试过这个。此代码不保存配置文件设置i-e City。我的代码只适用于如果我在step0中声明cityTextbox并像这样调用我的代码; _var cityField =(TextBox)CreateUserWizard.CreateUserWizardStep0.ContainerTempalate.FindControl(“City”); _ – 2012-02-28 16:43:41
我已经读过这个,但它说,一切都是在第一步创建的,即“”,而我想处理写在 –
2012-02-28 15:43:21