Javascript jquery plugin-selected-多个选择不在一行中列出,而是列中列出
我正在尝试配置我的列表框以使用jquery插件,选择1.4 我从数据库中获取ListBox的值,并将每个项目添加到ListBox中,代码隐藏效果良好:Javascript jquery plugin-selected-多个选择不在一行中列出,而是列中列出,javascript,jquery-plugins,jquery-chosen,Javascript,Jquery Plugins,Jquery Chosen,我正在尝试配置我的列表框以使用jquery插件,选择1.4 我从数据库中获取ListBox的值,并将每个项目添加到ListBox中,代码隐藏效果良好: //Populate the Recipient ListBox DataTable tdtRecipients = new DataTable(); tstrXmlTableData = m_pagingClient.GetRecipientList(m_strUserID); tdtRecipients = ParseXML(tst
//Populate the Recipient ListBox
DataTable tdtRecipients = new DataTable();
tstrXmlTableData = m_pagingClient.GetRecipientList(m_strUserID);
tdtRecipients = ParseXML(tstrXmlTableData);
// string tstrRecipientLst = string.Empty;
foreach (DataRow row in tdtRecipients.Rows)
{
lstBoxTo.Items.Add(row["Name"].ToString());
}
ListBox的样式是长的,如果需要,可以添加垂直滚动条。这来自样式表:
#lstBoxTo
{
width: 620px;
height: 40px;
overflow: scroll;
}
控件设置在面板中:
<asp:Panel ID="pnlTo" runat="server" CssClass="basicRow" ClientIDMode="Static">
<asp:Label ID="lblTo" runat="server" CssClass="labelText" Text="To: "
ClientIDMode="Static"></asp:Label>
<asp:ListBox ID="lstBoxTo" runat="server" SelectionMode="Multiple"
ClientIDMode="Static" ></asp:ListBox>
</asp:Panel>
,用于多选。但我不知道该设置什么选项或如何设置它们
任何帮助都将不胜感激
谢谢。
更新
删除ClientIDMode属性并向属性添加高度和宽度后,列表框将正确显示。
但在演示中,列表框应以“选择收件人”开头,并在键入时显示以下列表。列表显示在列表框中。我算出了。。。
我错过了选择的样式表。
补充:
到我的网站。主文件,它工作良好
希望这能帮助像我这样的新手
<script type="text/javascript">
$(window).load(function () {
$("#lstBoxTo").data("placeholder", "Choose recipient(s)...").chosen();
});
</script>