我有一个DropDownCheckBoxes
<asp:DropDownCheckBoxes CssClass="FreeTextFilterSelection" ID="cbMarket" AddJQueryReference="false" UseSelectAllNode="True"
AutoPostBack="true" DataTextField="Text" runat="server" OnSelectedIndexChanged="cbMarket_SelectedIndexChanged" style="height: 19px" >
<Texts SelectBoxCaption="" />
</asp:DropDownCheckBoxes>
和它的SelectedIndexChanged事件
protected void cbMarket_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
string s = string.Empty;
string s1 = string.Empty;
int i = 0;
foreach (ListItem item in (sender as DropDownCheckBoxes).Items)
{
if (item.Selected)
{
if (i > 0)
{
s = s + " ...";
break;
}
else
{
s1 = item.Text;
if (string.IsNullOrEmpty(s1))
s1 = "NULL";
s = s + s1;
}
i++;
}
}
(sender as DropDownCheckBoxes).Texts.SelectBoxCaption = s;
}
catch (Exception)
{
}
}
当我打开dropdowncheckbox并单击"Select all"
时,它会选择全部,当我取消选中Select all
时,它会取消选中,但当我想再次检查Select all
时,它不会检查所有选项
感谢您的帮助
答案 0 :(得分:0)
我刚刚解决了它
万一有人有同样的问题
aspx部分AddJQueryReference
中的应为true
<asp:DropDownCheckBoxes CssClass="FreeTextFilterSelection" ID="cbMarket" AddJQueryReference="true" UseSelectAllNode="True"
AutoPostBack="true" DataTextField="Text" runat="server" OnSelectedIndexChanged="cbMarket_SelectedIndexChanged" style="height: 19px" >
<Texts SelectBoxCaption="" />
</asp:DropDownCheckBoxes>