<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">
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句