如何从gridview获取具有分页的所有行? [英] How to get all rows from gridview having pagination?

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

问题描述

在gridview中选择已分页的行时,如果单击全部(顶部复选框),它只会显示所选页面,因此您必须依次浏览每个页面。



我想再创建一个复选框可能在外面,它选择gridview所有页面的所有复选框并给我结果,这样我就可以遍历gridview中存在的所有记录,而不是与pertuclar相关gridview的页面

When selecting rows in gridview who has got pagination , if you click All (Top checkbox), it only gives the selected page ,so you have to go through each page in turn.

I want to create one more checkbox may be outside , which selects all the checkboxes of the all pages of gridview and gives me the result so that i can loop through all the records present inside gridview and not rlated to pertuclar page of gridview

推荐答案

检查以下文章



如何从GridView中选择多个记录并在分页期间保留选择 [ ^ ]
Check following article

How to select multiple records from a GridView and persist the selection during pagination[^]


设置这个可能会有所帮助: -



EnablePersistedSelection =tr例如,
Setting this might be of help :-

EnablePersistedSelection="true"


可以迭代您的数据源;如果你使用数据表绑定数据



you can iterate on your data source, for example; if you bind data using data table

DataTable dt = // from your method call
Session["dt"] =dt;
//bind data to gridview 





当您需要迭代所有数据时,您可以迭代 Session [dt] ,将其强制转换回DataTable并迭代。



When you need to iterate over all the data, you can iterate over Session["dt"], cast it back to DataTable and iterate.


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

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