如何从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.