如何只获取gridview第1页的数据 [英] how to get only datas of page 1 of gridview

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

问题描述

我需要一个小帮助。

我有一个任务是将gridview的数据导出到excel,但条件是我只需要导出gridview的第一页数据。我怎样才能做到这一点? gridview的页面大小为50,但是数据可能会有所不同,我如何导出有时40或有时50或有时可能只有5 ...

请回复

hi frens, i need a small help.
I have a task to export the datas of gridview to excel but the condition is that i need to export only the first page datas of the gridview. How can i do that? the gridview has page size 50 but the datas may vary and how can i export like sometimes 40 or sometimes 50 or may be 5 only sometimes...
please reply

推荐答案

ASP.NET解决方案

您可以使用 GridView.AllowPaging [ ^ ]和 GridView.Rows.Count [ ^ ] properties。
Solution for ASP.NET
You can calculate it, using GridView.AllowPaging[^] and GridView.Rows.Count[^] properties.


您可以使用
datagrid.Rows.count

知道datagrid有多少行?

然后你可以选择一行机智h使用那个索引。比如这个

to know how many rows datagrid have?
Then you can select a row with use index of that.like this

datagrid.Rows[index]


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

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