【发布时间】:2015-02-21 01:22:07
【问题描述】:
当用户在向导的第一步之后单击“继续”时,我想检查 MyRadioBtn 的值(选定索引)是否为 1。如果不是,则打开一个面板,不要继续执行向导的第 2 步。
我遇到的问题是“MyRadioBtn.SelectedIndex”条件永远不会返回值 1。
前端:
<asp:RadioButtonList ID="MyRadioBtn" runat="server" AutoPostBack="True">
<asp:ListItem Value="0">No</asp:ListItem>
<asp:ListItem Value="1">Yes</asp:ListItem>
</asp:RadioButtonList>
代码隐藏:
protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
{
if (Wizard1.ActiveStepIndex == 0)
{
if (MyRadioBtn.SelectedIndex == 1)
{
//Stop the user from moving on to step 2
e.Cancel = true;
//Show the user a panel
WarningPanel.Visible = true;
}
else {
//Continue to STEP 2
}
}
}
【问题讨论】:
-
您是否验证了回发是否是使用网络工具触发的?
标签: c# asp.net validation radio-button radiobuttonlist