【发布时间】:2013-03-12 01:39:28
【问题描述】:
我在我的 uzerwizard 中添加了一个额外的步骤
<asp:TemplatedWizardStep id="stpPayment" runat="server" Title="Payment">
<ContentTemplate>
<asp:DropDownList ID="cmbSubs" runat="server" ClientIDMode="Static"
Width="200px">
<asp:ListItem Value="month">Monthly Subscription</asp:ListItem>
<asp:ListItem Value="year">Annual Subscription</asp:ListItem>
</asp:DropDownList>
我已成功导航到新步骤
protected void NewUserprofileWizard_NextButtonClick(object sender, WizardNavigationEventArgs e)
{
if (NewUserprofileWizard.ActiveStepIndex == 0)
{
NewUserprofileWizard.ActiveStepIndex = 1;
}
}
但我无法从我的代码隐藏中访问下拉列表 注意:我可以在第一步(创建用户)中获得控件的句柄。
但下一步中的任何控件总是返回 null。
这是我正在使用的代码
DropDownList cmb = (DropDownList)NewUserprofileWizard.WizardSteps[1].FindControl("cmbSubs");
我总是返回一个空值。
请注意,这很好用
TextBox tmp = (TextBox)NewUserprofileWizard.CreateUserStep.ContentTemplateContainer.FindControl("Email");
userProfile.AccountEmail = tmp.Text;
问题似乎是自定义步骤所独有的
感谢您的帮助
尝试了 Gregors 的建议。没运气。我的总是显示为空。
如果这有帮助: 我的向导在用户控件中.. 使用用户控件的页面位于母版页内.....
【问题讨论】:
标签: asp.net webforms asp.net-membership