gridview存儲過程
『壹』 aspnetpage控制項怎麼把gridview分頁 求詳細代碼 最好用存儲過程
沒用存貯過程的
private void Binder()
{
DataSet ds = DataHelpe.GetDataSet(strsql);
DataView dv = ds.Tables[0].DefaultView;
PagedDataSource pds = new PagedDataSource();
pagelist.RecordCount = dv.Count;
pagelist.AlwaysShow = true;
pagelist.PageSize = 20;
pds.DataSource = dv;
pds.AllowPaging = true;
pds.CurrentPageIndex = pagelist.CurrentPageIndex - 1;
pds.PageSize = pagelist.PageSize;
this.ddlUser.DataSource = pds;
this.ddlUser.DataBind();
this.pagelist.CustomInfoHTML = "記錄總數:" + pagelist.RecordCount.ToString() + "";
}
pagelist是分頁控制項的ID
//PageChanging這個事件是分頁控制項自帶的一個事件
protected void PageChanging(object src, PageChangingEventArgs e)
{
pagelist.CurrentPageIndex = e.NewPageIndex;
this.Binder();
}