如何在GridView中显示特定的记录集 [英] How to display specific set of records in GridView

查看:53
本文介绍了如何在GridView中显示特定的记录集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的项目中,我已拥有搜索"页面,并且正在使用GridView;我将PageSize设置为10.在数据库中,我有50条记录.因此,记录在5页中列出.选择页码后,我可以在gridview中显示适当的记录.但是,当我输入一些搜索条件时,列出的记录数为16,这些记录在两页中列出12.

在这里,我的选择是,当我选择第2页...时,无论我的搜索条件如何,都将从数据库中检索所有50个排列并显示在5页中.

您能否建议/帮助我如何在更改页面索引时仅显示下一组记录,而不是列出所有50条记录.

谢谢您,



in my project i''ve Search page & i''m using GridView; I set PageSize as 10. In the Database I''ve 50 records. So the records listed in 5 pages. On selecting a page number, i''m able to display appropriate records in gridview. But, when I enter some search criteria, the number of records listed are 16 and these records listed in two pages 1 2.

Here my probelm is, when I select pagenumber 2... all the 50 reords are getting retrieved from the database and displayed in five pages irrespective of my Search criteria.

Can you please advice/help me how to display only the next set of records when page Index is changed, instead of listing all the 50 records.

Thank you,

推荐答案

在Gridview_pageindex_changing事件中,

您检查Gridview的数据源,是否将获取所有记录或基于条件(搜索)的记录.那一点你错过了.

如果您需要更多说明,请在此处发布代码.
In the Gridview_pageindex_changing event,

you check the data-source of the gridview, whether it would get all records or condition(search) based records. That point you have missed.

If you require more explanation, post the code here.


这篇关于如何在GridView中显示特定的记录集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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