Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
XML
<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

C#
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
Posted
Comments
CHill60 11-Jun-15 5:47am    
Where's code for SelectAll?
Lalyka 11-Jun-15 5:50am    
I have not written the code, it's a ready asp property that I am using
and I have filled the box with Linq query
CHill60 11-Jun-15 6:10am    
ok - what is the linq query?
Lalyka 11-Jun-15 6:12am    
List<string> sRet = null;
try
{
IEnumerable<string> q = null;
q = (from a in ListMarkets
orderby a.Name
where a.Market != null
select a.Name).Distinct();

sRet = q.Distinct().ToList();
}
catch (Exception ex)
{
LoggerSoftwareUtility.Error(string.Format("ReportHelper:(ExtractModel) Exception: {0}", ex));
sRet = null;
}
return sRet;
CHill60 11-Jun-15 15:41pm    
Possibly a silly question - do you have the latest version of that extension, I do know that there have been bug fixes

1 solution

I just solved it

in case someone has the same problem

in aspx part AddJQueryReference should be true

XML
<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>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900