I have a gridview with rows and with pagination. I have the below jquery that searches for text in a text box and on clicking on a button it searches and displays all rows containing that text, but currently it only checks the first page. My question is how it can search through all the pages of the gridview control
$(document).ready(function() {
$('#<%=lblNoRecords.ClientID%>').css('display','none');
$('#<%=btnSubmit.ClientID%>').click(function(e)
{
// Hide No records to display label.
$('#<%=lblNoRecords.ClientID%>').css('display','none');
//Hide all the rows.
$("#<%=gdRows.ClientID%> tr:has(td)").hide();
var iCounter = 0;
//Get the search box value
var sSearchTerm = $('#<%=txtSearch.ClientID%>').val();
//if nothing is entered then show all the rows.
if(sSearchTerm.length == 0)
{
$("#<%=gdRows.ClientID%> tr:has(td)").show();
return false;
}
//Iterate through all the td.
$("#<%=gdRows.ClientID%> tr:has(td)").children().each(function()
{
var cellText = $(this).text().toLowerCase();
//Check if data matches
if(cellText.indexOf(sSearchTerm.toLowerCase()) >= 0)
{
$(this).parent().show();
iCounter++;
return true;
}
});
if(iCounter == 0)
{
$('#<%=lblNoRecords.ClientID%>').css('display','');
}
e.preventDefault();
})
})