关于使用datagrid的两个问题,help...
private void BindGrid()
{
this.myconn.FillDataSet(titleDataSet1);
this.DataGrid1.DataBind();
}
private void Page_Load(object sender, System.EventArgs e)
{
if(this.IsPostBack)
return;
BindGrid();
}
private void Button1_Click(object sender, System.EventArgs e)
{
this.DataGrid1.CurrentPageIndex=0;
this.myconn.SqlDataAdapter1.SelectCommand.CommandText="select * from title_gov where "+ddlsearchclass.SelectedValue+" like '%"+tbsearchkey.Text+"%'";
BindGrid();
}
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
this.DataGrid1.CurrentPageIndex=e.NewPageIndex;
BindGrid();
}
我点击按钮button1的时候 DataGrid1显示出要查询的内容,DataGrid1将查询的记录分为4页,,当我点击第2页的时候,却跑到Page_Load时的第2页去了,怎么解决啊?help。。。
还有我怎么定义DataGrid1的行距啊?help。。