使用j查询单击gridview中的编辑按钮时,分页无法正常工作 [英] Paging doesn't work properly on clicking edit button in gridview using j query

查看:52
本文介绍了使用j查询单击gridview中的编辑按钮时,分页无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 () {
                // Setup - add a text input to each footer cell
                $('#<%=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 != " ") {
                            //$(this).html(title + '<br/><input type="text" style="background-color:#646464;border:none" disabled="disabled"   />');
                        }
                    }
                });

                // DataTable
                //var table = $('#<%=GridView1.ClientID %>').DataTable({
                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>// DataTable
                //var table = $('#<%=GridView1.ClientID %>').DataTable({
                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
                });



通过这样做,我可以在gridview中点击编辑按钮停留在同一页面,这解决了我的问题,但再次,如果我正在运行该应用程序或再次如果我再次登录我看到了我在运行应用程序之前的帽子页面,而不是看到gridview的第一页


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

推荐答案

(function(){
//设置 - 添加文本输入每个页脚单元格
(function () { // Setup - add a text input to each footer cell


('#<%= GridView1.ClientID%> th')。each(function(){
var title =
('#<%=GridView1.ClientID %> th').each(function () { var title =


(this).text();
if(title ==Audio Name| | title ==医师姓名|| title ==Specialty){
(this).text(); if (title == "Audio Name" || title == "Physician Name" || title == "Speciality") {


这篇关于使用j查询单击gridview中的编辑按钮时,分页无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆