GridView 在回发期间丢失数据 [英] GridView loses data during postback

查看:33
本文介绍了GridView 在回发期间丢失数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 gridview 的 aspx.Page.只有当没有发生回发并且 enableviewstate = true(页面也是)时,gridview 才会在代码后面绑定到数据源.在回发期间,绑定到 gridview 的数据将丢失.可能是什么原因.请问是否需要代码.

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 too). During a postback, the data bound to the gridview are lost. What could be the reason. Please ask if code is needed.

推荐答案

解决了,问题是我用gridview在页面的masterpage的Page_Load事件中做了一个Page.Databind(),所以绑定了gridview每个没有数据的回发.感谢大家的努力.

Solved it, problem was I made a Page.Databind() in the Page_Load event of the masterpage of the page with the gridview, so it bound the gridview during each postback without data. Thanks for all efforts.

这篇关于GridView 在回发期间丢失数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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