Select all rows from one checkbox in a GridView

Page Markup

<asp:GridView runat="server" ID="grdAbsentApprovals" ShowHeader="true" ShowHeaderWhenEmpty ="true"  Width="100%"
                            CssClass="mGrid" AutoGenerateColumns="False">
                               <AlternatingRowStyle BackColor="#EEEEEE" />
                    <input type="checkbox" id ="chkSelectAll" onclick="SelectAllCheckboxes(this)"></checkbox>
                            <asp:CheckBox runat="server" ID="chkItem" />
                    <asp:BoundField DataField="DOC_NO" HeaderText="DOC NO" SortExpression="DOC_NO" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" />
                    <asp:BoundField DataField="NAME" HeaderText="NAME" SortExpression="NAME" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" />
                     <asp:BoundField DataField="NOOFDAYS" HeaderText="DAYS" SortExpression="NOOFDAYS" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="DESCRIPTION" HeaderText="DESCRIPTION" SortExpression="DESCRIPTION"  HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"/>
                No Data Found.



  function SelectAllCheckboxes(chk) {
                    $('#<%=grdAbsentApprovals.ClientID%>').find("input:checkbox").each(function () {
                        if (this != chk) { this.checked = chk.checked; }


One thought on “Select all rows from one checkbox in a GridView

  1. I will immediately grab your rss feed as I can not find your email subscription link or enewsletter service. Do you’ve any? Please let me know in order that I could subscribe. Thanks. kdadgbfgbdce

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s