does gridview save data in viewstate?

前端 未结 3 1340
轻奢々
轻奢々 2020-12-19 18:57

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 th

3条回答
  •  情深已故
    2020-12-19 19:03

    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.

提交回复
热议问题