GridView loses data during postback

后端 未结 5 1225
我在风中等你
我在风中等你 2021-01-12 09:22

I have an aspx.Page containing a gridview. The gridview is bound in code behind to a datasource only when no postback takes place and has enableviewstate = true (The page to

5条回答
  •  無奈伤痛
    2021-01-12 09:51

    from the description of the problem. it sounds as if you are doing the databinding in the code behind. in such case asp.net does not preserve the datasource in the viewstate for you. try retrieving the data and storing it in the ViewState hashtable object with something like ViewState["GridviewData"] = GridviewData

    and retreiving it from there between postbacks

提交回复
热议问题