简单的脚本来引导申请分页样式在asp.net中的GridView [英] simple script to apply bootstrap pagination style in asp.net gridview

查看:99
本文介绍了简单的脚本来引导申请分页样式在asp.net中的GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有简单的jQuery脚本/插件,在asp.net中gridview的应用引导分页样式?我发现如何做到这一点,像这些链接一些好的建议:的这里这里
这些提示/解决方案唯一的问题是,我们需要做出很大的改变来实现的结果,当你有很大的应用程序,并要改造它来引导的风格,这不是preferable。我们需要另一种解决方案。就像一个简单的jQuery脚本,可以做的工作不做很大的改动,以目前的code。

is there any simple jquery script/plugin to apply bootstrap pagination style in asp.net gridview ? I've found some good tips about how to do this, like these links: here and here. the only problem with these tips/solutions is we need to make a lot of changes to achieve the result and this is not preferable when you have large application and you want to transform it to bootstrap style. we need another solution. like a simple jquery script that can do the job without making lot changes to the current code.

推荐答案

我做了简单的jQuery脚本应用引导分页在asp.net GridView和我认为这将是有益的在这里分享它的计算器。
这个脚本来源$ C ​​$ C在托管github上这里

I've made simple jquery script to apply the bootstrap pagination in asp.net gridview and I think it will be useful to share it here in stackoverflow. source code of this script is hosted in github here.

用法很简单:

-include在asp.net页面文件的插件js文件:

-include the plugin js file in your asp.net page file:

<script type="text/javascript" src="js/bs.pagination.js"></script>

-set GridView控件属性:

-set gridview property:

PagerStyle-CssClass="bs-pagination"

这就是你需要在asp.net gridview的应用引导分页样式。

that's is all you need to apply bootstrap pagination style in asp.net gridview.

检查我的博客了解更多信息。

check my blog for more info.

编辑:

,这个问题的原因是因为的UpdatePanel完全取代上一个更新的更新面板的内容。这意味着我们订阅这些事件不再订阅,因为有在更新面板新元素。

about the problem when using gridview inside UpdatePanel, the reason of this problem is because "UpdatePanel completely replaces the contents of the update panel on an update. This means that those events we subscribed to are no longer subscribed because there are new elements in that update panel."

有一个以上的解决方案来解决这个问题:

There is more than one solution to solve this problem:

解决方案1:

使用页面加载()而不是$(文件)。就绪。修改code是这样的:

Use pageLoad() instead of $(document).ready. Modify the code like this:

function pageLoad() {
            $('.bs-pagination td table').each(function (index, obj) {
                convertToPagination(obj)
            });
        }

Solution2:

每次更新后重新改变风格。我们可以通过添加这些行到bs.pagination.js文件做到这一点:

re-change the style after every update. We can do this by adding these lines to the bs.pagination.js file:

var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_endRequest(function () {
    $('.bs-pagination td table').each(function (index, obj) {
        convertToPagination(obj)
    });
});

这篇关于简单的脚本来引导申请分页样式在asp.net中的GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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