Click here to Skip to main content
15,921,028 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hello guys.

im have a little problem here.

im using a checkboxlist, and the data im using in the list is coming from my database, how can i check/uncheck all the list in the checkbox list?


thank you in advance! :)



-CHAOSGRAY-
Posted
Updated 6-Jun-11 16:02pm
v3
Comments
walterhevedeich 7-Jun-11 0:48am    
Can you post the code that pulls the data from the database and puts it to your checkboxlist?

1 solution

Below link will give you detail process with explainations to achieve what you want:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=77[^]

Basically it is just a javascript:

XML
<script language="javascript" type="text/javascript">

function CheckBoxListSelect(cbControl, state)
{
       var chkBoxList = document.getElementById(cbControl);
        var chkBoxCount= chkBoxList.getElementsByTagName("input");
        for(var i=0;i<chkBoxCount.length;i++)
        {
            chkBoxCount[i].checked = state;
        }

        return false;
}

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