不GridView控件保存在ViewState中的数据? [英] does gridview save data in viewstate?

查看:96
本文介绍了不GridView控件保存在ViewState中的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我一个DataTable绑定到一个gridview。
我想使用一些回发事件的数据表,以及ii要使用视图状态。
不GridView控件保存在ViewState中的数据?如果没有什么是最好的方式做到这一点。

hi i bind a DataTable to a gridview. i want to use the DataTable in some postback event, and ii want to use viewstate. does gridview save data in viewstate? if no what is the best way to do this.

(完整的故事:
我有一个从标准asp.net GridView控件派生的自定义的GridView,
我把一个按钮头数据导出至Excel,我想使用保存在ViewState中的数据导出到Excel)

(full story : i have a custom gridview derived from standard asp.net gridview, and i put a button in header to export data to excel, i want to use data saved in viewstate to export to excel)

感谢

推荐答案

简短的回答是肯定的,在GridView显示的信息,就像任何控制的当前状态,存储在ViewState中。不过,我不认为这是很容易,如果连可能的话,要得到这个数据自己出的ViewState的集合,是可供器WebControls的。相反,ASP.NET从填充值的ViewState在生命周期中运行的事件处理程序之前,所以如果你是一个处理器询问你的GridView对象服务器端,你应该看到电池的电流值。

The short answer is yes, information shown in the GridView, much like the current state of any control, is stored in ViewState. However, I do not think it is easy, if even possible, to get to this data yourself out of the ViewState collection that is available to WebControls. Instead, ASP.NET populates values from ViewState before running event handlers in the lifecycle, so if you interrogate your GridView object server-side in a handler, you should see the current values of the cells.

这篇关于不GridView控件保存在ViewState中的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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