GridView loses data during postback

后端 未结 5 1194
我在风中等你
我在风中等你 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:53

    Ok I know the reply is really late, but I just encountered the same problem.

    I was Databinding everytime I loaded the page, and when there was a post back the gridview requeried. But using:

    if(!IsPostBack)
    { //code used to bind on first page load }
    

    in the Page_Load event seemed to have helped :)

提交回复
热议问题