[英]Drop-Down-Check-Boxes select un-select malfunction
I Have a DropDownCheckBoxes 我有一个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>
and SelectedIndexChanged event for it 和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)
{
}
}
when I open the dropdowncheckbox and click "Select all"
it selects all and when I uncheck Select all
it unchecks all but when I want to check Select all
again, it does not check all the options 当我打开下拉复选框并单击
"Select all"
它会选择所有内容;当我取消选中"Select all"
它会取消Select all
,但是当我要再次Select all
时,它不会选中所有选项
thanks for the help 谢谢您的帮助
I just solved it 我刚刚解决了
in case someone has the same problem 万一有人有同样的问题
in aspx part AddJQueryReference
should be true
在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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.