![](/img/trans.png)
[英]Problemswith DropDownList in customized ASP.NET CreateUserWizard
[英]How to handle CreateUserWizard Steps in Asp.Net?
我在項目中使用過asp.net creatuserwizard。 我的自定義模板如下所示
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep0" runat="server">
<ContentTemplate>
//my custom code is here
</ContentTemplate>
<CustomNavigationTemplate>
</CustomNavigationTemplate>
</asp:CreateUserWizardStep>
現在,在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>
因此,我的問題是,當我在步驟2中單擊下一步時,如何在用戶個人資料中插入“城市”文本框值。
您可以處理“創建用戶向導”的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
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.