>>>建立一个button名字为Button1how did you create the button? did you useButton1 = new Button();
Form1.Controls.Add(Button1);or you have Button1 in your page?

解决方案 »

  1.   

    yeah,button1 is in my page,i drag it to my page.then i double click on the button,enter the .cs pagethen code as beforethen testthen errorthanks
      

  2.   

    你是不是用asp.net?
    如果是,数据(应该是个dataset之类的吧?)是不会在页面往返时保持的。
    我一般是在session中保持数据
      

  3.   

    是在用asp.net
    threads是一个dataGrid
    请红耗子再解释一下
    谢谢
     
      

  4.   

    和winform不同,webform实际并不会保存数据。实际上,每次提交之后,都会生成一个新的实例,只不过微软处理得比较巧妙,看以来象是同一个实例。
    所以,数据(包括控件的状态)都是以session或viewstat的方式在页面往返时传递的。把你的数据源存放在session里,页面刷新时取出,赋给一个新的数据源,然后把datagrid绑定到新的数据源。否则数据源就空了。
      

  5.   

    將這句中的this.threads.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.threads_PageIndexChanged_1);括號內容改為
    :this.threads_PageIndexChanged