Click here to Skip to main content
13,006,020 members (66,991 online)
Click here to Skip to main content
Add your own
alternative version


6 bookmarked
Posted 18 Apr 2011

Select all checkbox in the data grid

, 18 Apr 2011
Rate this:
Please Sign up or sign in to vote.
This is an example to make a "Select All" check box using JQuey
Prerequisite: include JQuery script file

<script src="jquery-1.4.2.min.js" type="text/javascript"></script>

This tip is to create a "Check All" checkbox which will select all the checkboxes in the grid or on the page or if you uncheck individual check box, then it will uncheck the "Select All"check box.

If the check box is disabled, then it will not inlude this in the selection.

This is the aspx code:

<script language="javascript" type="text/javascript">
                            if($('input:checkbox:not(:disabled, :checked)').not('#chkSelectAll').length == 0)
                                $('#chkSelectAll').attr('checked', true)
                                $('#chkSelectAll').attr('checked', false)
                   ).attr('checked', this.checked);
<table width="150" id="ttt">
               <asp:CheckBox ID="chkSelectAll" runat="server" Text="Select All" />
                    <br />
                    <asp:CheckBox ID="chkBx1" runat="server" Text="CheckBox 1" Enabled="false" />
                    <br />
                    <asp:CheckBox ID="chkBx2" runat="server" Text="CheckBox 2" />
                    <br />
                    <asp:CheckBox ID="chkBx3" runat="server" Text="CheckBox 3" />
                    <br />
                    <asp:CheckBox ID="chkBx4" runat="server" Text="CheckBox 4" />


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


About the Author

Software Developer (Senior)
India India
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionIE6 browser comptability issue Pin
Poonamchand Soni30-Aug-13 0:31
memberPoonamchand Soni30-Aug-13 0:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170628.1 | Last Updated 18 Apr 2011
Article Copyright 2011 by nit_singh
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid