在ASP.Net中的Gridview中分页 [英] Paging in Gridview in ASP.Net

查看:57
本文介绍了在ASP.Net中的Gridview中分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的程序员,

我在Gridview中实现了分页,为了避免与数据库的频繁重新连接,我使用Session来存储数据.以便可以在更改Gridview的页面索引时从会话中检索数据.
但是我的问题是,什么时候应该清除此会话,因为它仅可用于此页面.如果我使用ViewState,那么如果数据量增加,那就没用了.



期待您的宝贵建议.....
在此先感谢
Supriya

Dear Programmers,

I have implemented paging in Gridview and in order to avoid frequent Reconnection with database,I used Session to store data.So that data could be retrieved from session on changing page index of Gridview.
But my problem is that when should I clear this session as it''s usable only for this very page.And if I use ViewState then it will not be fine if data increases in amount.



Looking forward for valuable suggestion of yours.....
Thanks in advance
Supriya

推荐答案

如果为会话密钥添加 ^ ]或 UniqueID [ ^ ],例如:

If you prefix the session key with ClientID[^] or UniqueID[^] like:

Session[gridView.UniqueID + "_DataForGrid"] = gridItems;



您应该能够解决您的问题.

最好的问候
Espen Harlinn



You should be able to solve your problem.

Best regards
Espen Harlinn


这篇关于在ASP.Net中的Gridview中分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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