本文介绍了下拉复选框选择取消选择故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打开下拉复选框并单击全选"时,它会选择所有内容,而当我取消选中全选"时,它会取消选中所有内容,但是当我要再次选中全选"时,它不会选中所有选项.


我有一个DropDownCheckBoxes

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


I Have a 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事件



and SelectedIndexChanged event for it

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)
            {

            }

        }



在此先感谢



Thanks in advance

推荐答案

<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>


这篇关于下拉复选框选择取消选择故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 21:16