Below is my jquery code to implement search filter for gridview along with paging,i am able to implement searching but the problem is in paging if i click edit button i am getting back to first page of my gridview instead of staying in that particular page.How to get stayed in that particular page on clicking edit button in gridview
<script>
$(function () {
$('#<%=GridView1.ClientID %> th').each(function () {
var title = $(this).text();
if (title == "Audio Name" || title == "Physician Name" || title == "Speciality") {
$(this).html(title + '<br/><input type="text" style="width:120px" placeholder="Search ' + title + '" />');
}
else {
if (title != " ") {
}
}
});
var table = $('#<%=GridView1.ClientID %>').prepend($('<thead></thead>').append($('#<%=GridView1.ClientID %>').find('tr:first'))).DataTable({
"paging": true,
"ordering": false,
"info": false,
"pageLength": 10,
"bLengthChange": false
});
table.columns().every(function () {
var that = this;
$('input', this.header()).on('keyup change', function () {
if (that.search() !== this.value) {
that
.search(this.value)
.draw();
}
});
});
});
</script>
What I have tried:
I tried by taking bsavestate=true as shown below
<pre>
var table = $('#<%=GridView1.ClientID %>').prepend($('<thead></thead>').append($('#<%=GridView1.ClientID %>').find('tr:first'))).DataTable({
"paging": true,
"ordering": false,
"info": false,
"pageLength": 10,
"bsavestate"=true,
"bLengthChange": false
});
By doing in this way i am able to stay in the same page on clicking edit button in gridview which solves my problem but again if i am running the application or again if i am again getting logged in i am seeing that page where i was before running the application instead of seeing first page of gridview