请大侠们帮我看看分页问题
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
bind();
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
bind();//问题在这,当触发分页事件再次调用bind()时,实际上mysql=null了所以看到页面也是空白的。
//请坛友们帮帮忙,本人实在是没办法了。如果有什么不便也可发到信箱fontpage2000@163.com
//万分感谢,因为最大只能给100分,为表示感谢,我将另外200分,将多开两贴付与。
}
void bind()
{
string myyyyy = Request.Form["签否"];
string mysql = "select * from table1 where 签否='" + myyyyy + "'";
SqlConnection myconnection = new SqlConnection();
myconnection.ConnectionString=@"data source=.\sqlexpress;attachdbfilename=|datadirectory|\mydb1.mdf;integrated security=true;user instance=true";
SqlCommand mycommnad = new SqlCommand();
mycommnad.Connection = myconnection;
mycommnad.CommandText = mysql;
var mysqldataadapter = new SqlDataAdapter();
mysqldataadapter.SelectCommand = mycommnad;
var mydataset = new DataSet();
mysqldataadapter.Fill(mydataset, "mytable");
GridView1.DataSource = mydataset.Tables["mytable"];
GridView1.DataBind();
}