【发布时间】:2014-04-17 12:11:45
【问题描述】:
在我的应用程序中,我使用列表框作为多选模式。我需要在不使用的情况下为列表框触发 SelectedIndexChanged event
autopostback(AutoPostBack=True)
在 C# 中。我怎样才能做到这一点?
【问题讨论】:
-
您想完成什么,我们或许可以为您提供可能的解决方案?
在我的应用程序中,我使用列表框作为多选模式。我需要在不使用的情况下为列表框触发 SelectedIndexChanged event
autopostback(AutoPostBack=True)
在 C# 中。我怎样才能做到这一点?
【问题讨论】:
将您的列表框带入更新面板,如下所示:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:ListBox ID="ListBox1" SelectionMode="Multiple" OnSelectedIndexChanged="ListBox1_SelectedIndexChanged" AutoPostBack="true" runat="server">
<asp:ListItem Text="text 1" Value="0"></asp:ListItem>
<asp:ListItem Text="text 2" Value="1"></asp:ListItem>
<asp:ListItem Text="text 3" Value="2"></asp:ListItem>
<asp:ListItem Text="text 4" Value="3"></asp:ListItem>
<asp:ListItem Text="text 5" Value="4"></asp:ListItem>
</asp:ListBox>
</ContentTemplate>
</asp:UpdatePanel>
【讨论】:
AutoPostBack="true"