启用分页时如何获取Gridview的所有行? [英] How to Fetch All Rows Of Gridview When Paging is Enabled??

查看:86
本文介绍了启用分页时如何获取Gridview的所有行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启用分页后如何获取全部gridview的行?.

How to Fetch All The rows of gridview when paging is enabled?.

它允许仅获取当前的获取行,而不是整个gridview行.

it is allowing to fetch only current fetch rows not entire gridview rows.

推荐答案

我们暂时禁用分页,并将重新绑定网格,以便现在我们可以访问数据源中的所有记录,而不仅仅是当前页面记录.

We disable paging temporarily and will re-bind the grid so that now we have access to all records in the datasource not just current page records.

一旦gridview与所有记录绑定,您就可以遍历gridview行.

Once gridview is binded with all records, you can iterate through gridview rows.

完成任务后,我们将重新启用分页并重新绑定网格.

Once we are done with our task, we re-enable paging and rebind the grid.

以下是解决您的情况的方法:

Here the way to tackle with your condition:

protected void Page_Load(object sender, EventArgs e)
{
    GridView2.AllowPaging = false;
    GridView2.DataBind(); 

    // You can select some checkboxex on gridview over here..

    GridView2.AllowPaging = true;
    GridView2.DataBind(); 
}

这篇关于启用分页时如何获取Gridview的所有行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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