如果在第一个下拉框中选择了手机,我想关闭下拉PhoneHelp,但它似乎不起作用。这是代码:
达网络
<asp:DropDownList ID="ddlHowRec" runat="server">
<asp:ListItem Value="" Text="Choose an option"></asp:ListItem>
<asp:ListItem Value="mail" Text="Mail"></asp:ListItem>
<asp:ListItem Value="e-mail" Text="E-mail"></asp:ListItem>
<asp:ListItem Value="phone" Text="Call back"></asp:ListItem>
</asp:DropDownList>
<asp:Label ID="lblPhoneHelp" runat="server" AssociatedControlID="ddlPhoneHelp"></asp:Label>
<asp:DropDownList ID="ddlPhoneHelp" runat="server">
<asp:ListItem Value="" Text="Choose an option"></asp:ListItem>
<asp:ListItem Value="yes" Text="Yes"></asp:ListItem>
<asp:ListItem Value="no" Text="No"></asp:ListItem>
</asp:DropDownList>
VB:
Protected Sub ddlHowRec_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlHowRec.SelectedIndexChanged
If ddlHowRec.SelectedValue = "phone" Then
lblPhoneHelp.Enabled = False
Else
lblPhoneHelp.Enabled = True
End If
End Sub
谢谢
答案 0 :(得分:3)
您正在停用lblPhoneHelp
而不是ddlPhoneHelp
。
ddlPhoneHelp.Enabled = Not ddlHowRec.SelectedValue = "phone"