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

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

问题描述

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

解决方案,问题是我在Page_Load事件中创建了一个Page.Databind()带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.

解决方案

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天全站免登陆