可能是你的pageload中沒有用!IsPostBack導致

解决方案 »

  1.   

    在page_load中加入:
    if (!IsPostBack)
    {
    this.DataGrid1.DataBind();
    }试试看,应该可以了。
      

  2.   


    !IsPostBack这样只在第一次打开的时候才绑定数据
      

  3.   

    楼主根据楼上的建议就可以了。
    page_load里有下面语句
    if (!IsPostBack)
    {
     binddata()
    }
      

  4.   

    Sub binddata()
             oil_dataset.Clear();
             DataGrid1.Dispose();
            oil_command = New SqlDataAdapter("select * from aa", ncconn)
            oil_command.Fill(oil_dataset, "by_data")
            DataGrid1.DataSource = oil_dataset.Tables("by_data").DefaultView
            DataGrid1.DataBind()
            Label1.Text = oil_dataset.Tables("by_data").Rows.Count
        End Sub
    試試