0

我在列表框上使用Jquery Chosen Plugin来选择多个项目。但是当我检索selected项目时,它确实有效,并且所选项目的数量保持为 0。

这就是我应用控件的方式:

<script type="text/javascript">
     function pageLoad(sender, args) {
            $('#<%= this.listBox.ClientID%>').chosen();
        }
</script>

<asp:Panel ID="pnlAddUpdate" runat="server">
  <asp:UpdatePanel ID="updpAddUpdate" runat="server" UpdateMode="Conditional">
     <asp:ListBox ID="listBox" runat="server" SelectionMode="Multiple"></asp:ListBox>
  </asp:UpdatePanel>
</asp:Panel>

这是我的代码隐藏:

foreach (ListItem item in this.listBox)
    {
        if (item.Selected)
            list.Add(Convert.ToInt32(item.Value));
    }

列表仍然是空的……知道我错过了什么吗?

4

0 回答 0