gpt4 book ai didi

asp.net - 更新面板不起作用,不知道为什么

转载 作者:行者123 更新时间:2023-12-04 05:51:12 24 4
gpt4 key购买 nike

如果在第一个下拉框中选择了电话,我想关闭下拉 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

谢谢

最佳答案

您正在禁用 lblPhoneHelp而不是 ddlPhoneHelp .

ddlPhoneHelp.Enabled = Not ddlHowRec.SelectedValue = "phone"

关于asp.net - 更新面板不起作用,不知道为什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10018060/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com