gpt4 book ai didi

asp.net - 在selectedindexchanged中的asp.net列表框不会触发事件

转载 作者:行者123 更新时间:2023-12-02 05:37:21 25 4
gpt4 key购买 nike

<asp:ListBox ID="list1" runat="server" Height="200" Style=" margin: 0"   OnSelectedIndexChanged="list1_SelectedIndexChanged">
<asp:ListItem Selected="True" Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
</asp:ListBox>

我在updatePanel中有列表框

但是,当我选择某些东西时,它不会触发事件,这是怎么回事?

最佳答案

您需要将AutoPostBack属性设置为True。那么只有回发发生,并且您选择的索引事件将触发。

<asp:ListBox AutoPostBack="true" ID="yourLIst" runat="server" Height="200" Style=" margin: 0"   OnSelectedIndexChanged="yourLIst_SelectedIndexChanged">

关于asp.net - 在selectedindexchanged中的asp.net列表框不会触发事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18227835/

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