关于DataSet的一个简单问题 点击button1之后,页面重新Load,this.dataSet1的值被清空了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在Button2_Click代碼最前面加上Button1_Click(sender,e); 建议如下修改button1中,最后添加一句da.Fill(dataSet1,"employees");之后添加:this.viewState["db"] = this.dataSet1;button2中this.DataGrid1.DataSource=dataSet1.Tables["employees"].DefaultView;---》this.DataGrid1.DataSource=((DataSet)this.viewstate["db"]).Tables["employees"].DefaultView; protected System.Web.UI.WebControls.Button Button1; protected System.Web.UI.WebControls.Button Button2; protected System.Web.UI.WebControls.DataGrid DataGrid1; protected Static DataSet dataSet1; 你需要理解页面执行顺序,你的程序:private void InitializeComponent() { this.dataSet1 = new System.Data.DataSet();当点击按钮后,页面回发,但它还是会建立页实例,同时又建立了DataSet,所以并没有到对象的引用 ASP.NET Htmlencode转换写入数据库 使用SqlParameter不能给Top后面赋值 视频网站播放器的问题~~~~~ 有没有哪位大哥用C#写过短信接口进来看看 关于面向对象 急请教,Asp.net操作Excel对象出现“服务器出现意外情况” 问个有关sqlserver的问题 会话标识未更新与已解密登陆请求安全BUG的修复问题? 如何把查询得到的值附给message.text?? 什么地方有vss6.0c下载? 如何取得客户端动态生成的控件的值? 请帮忙了,这个问题困扰我很久了,都没有办法解决!!
Button1_Click(sender,e);
button1中,最后添加一句
da.Fill(dataSet1,"employees");
之后添加:
this.viewState["db"] = this.dataSet1;button2中
this.DataGrid1.DataSource=dataSet1.Tables["employees"].DefaultView;
---》
this.DataGrid1.DataSource=((DataSet)this.viewstate["db"]).Tables["employees"].DefaultView;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected Static DataSet dataSet1;
private void InitializeComponent()
{
this.dataSet1 = new System.Data.DataSet();当点击按钮后,页面回发,但它还是会建立页实例,同时又建立了DataSet,所以并没有到对象的引用