I wirte the jacascript to search the term in asp grid view following
<script type="text/javascript">
$(document).ready(function () {
$('#<%=lblNoRecords.ClientID%>').css('display', 'none');
$('#<%=txtSearch.ClientID %>').live("keyup", function () {
$('#<%=lblNoRecords.ClientID%>').css('display', 'none'); // Hide No records to display label.
$("#<%=dgv_allCategory.ClientID%> tr:has(td)").hide(); // Hide all the rows.
var iCounter = 0;
var sSearchTerm = $('#<%=txtSearch.ClientID%>').val(); //Get the search box value
if (sSearchTerm.length == 0) //if nothing is entered then show all the rows.
{
$("#<%=dgv_allCategory.ClientID%> tr:has(td)").show();
return false;
}
//Iterate through all the td.
$("#<%=dgv_allCategory.ClientID%> tr:has(td)").children().each(function () {
var cellText = $(this).text().toLowerCase();
if (cellText.indexOf(sSearchTerm.toLowerCase()) >= 0) //Check if data matches
{
$(this).parent().show();
iCounter++;
return true;
}
});
if (iCounter == 0) {
$('#<%=lblNoRecords.ClientID%>').css('display', '');
}
});
})
function ClientValidate() {
$("#form1").validate({
rules: {
'<%=txtcategoryNm.UniqueID %>': "required"
},
messages: {
'<%=txtcategoryNm.UniqueID %>': 'enter name'
}
});
}
$(document).ready(function () {
$(".deleteGridRecord").click(function () {
var record_id = $(this).attr("id");
var row = $(this).closest("tr");
if (confirm("Are you sure to Delete record ?")) {
$.ajax({
type: "POST",
url: "Category.aspx/DeleteCategary",
data: "{'args':'" + record_id + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
if (r.d) {
row.remove();
if ($("[id*=dgv_allCategory] td").length == 0) {
$("[id*=dgv_allCategory] tbody").append("<tr><td colspan=6 align='center'> No Records found</td></tr>");
}
}
}
});
}
return false;
});
});
</script>
It work but when data grid viewconain more data and i use paging for that in that condition my searching javascript show me result of current page only i want to search whole page data and show the result
This javascrip search contain only from current page!!! i want to search whole data