I want to select all row of all pages in asp.net grid view when select all check box is checked using jquery,my code selecting the value of only first page.
<script type="text/javascript">
function SelectAllCheckboxes(chk) {
debugger;
$("[id*=chkSelectAll]").live("click", function () {
var chkHeader = $(this);
$("#<%=gvUnPaidInvoiceDetail.ClientID%> tr").each(function () {
var grid = $(this).closest("table");
$("[id*=chkSelect]", grid).each(function () {
if (chkHeader.is(":checked")) {
$(this).attr("checked", "checked");
} else {
$(this).removeAttr("checked");
}
});
});
});
}
</script>
<asp:TemplateField HeaderText="Select">
<HeaderTemplate>
<asp:CheckBox ID="chkSelectAll" runat="server" Text="" onclick="SelectAllCheckboxes(this);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
</asp:TemplateField>