[英]C#: How do I check the value of a field before Wizard's next step? (NextButtonClick)
在向導的第一步之后,當用戶單擊“繼續”時,我想檢查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
}
}
}
用戶從de DropDownList中選擇一個項目后,是否需要開槍? 如果不是, AutoPostBack="True"
更改為AutoPostBack="False"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.