Problem:

I had to check and uncheck all list items in the ASP.Net Checkboxlist control when a single ‘All’ checkbox is checked and unchecked respectively. I also had to uncheck the ‘All’ checkbox if any of the checkboxlist item is unchecked and check if all items in checkboxlist are checked.

Solution:

I used  JQuery to identify the check and uncheck event on checkboxes and perform the needed actions.

Below is the layout of  the asp.net controls:

Visually, It looked like below without the mouse pointer and all unchecked. 🙂

Now, the main logic to get this all working. If you dont know how jquery works, please visit www.jquery.com.

That’s it. Any questions n comments are welcome.

Happy Coding!

Check or Uncheck all checkboxes in CheckBoxList control
Tagged on:     

2 thoughts on “Check or Uncheck all checkboxes in CheckBoxList control

  • November 27, 2013 at 4:11 am
    Permalink

    my question is

    in the above example i deselect(uncheck) the any item(mobile) the checkbox(All) also deselected.
    is it possible or not in C#

    Reply
    • December 25, 2013 at 8:40 pm
      Permalink

      I am sure it can be done but requires post back. What is the reason you want to do it in C#?

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *