/// <summary>
/// repeater控件分页
/// </summary>
/// <param name="ds">数据源</param>
/// <param name="curpage">当前页</param>
/// <param name="re">repeater</param>
/// <returns></returns>
public static string SqlPage(DataSet ds, int curpage, System.Web.UI.WebControls.Repeater re, string url)
{System.Web.UI.WebControls.PagedDataSource pds = new System.Web.UI.WebControls.PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.PageSize = 2;
int pagecount = pds.PageCount;
int dbcount = ds.Tables[0].Rows.Count;
pds.CurrentPageIndex = curpage;
re.DataSource = pds;
re.DataBind();
int prepage = (curpage - 1) <= 0 ? 0 : (curpage - 1);
int nextpage = (curpage + 1) > pagecount ? pagecount : (curpage + 1);
string pagestr = "共 " + pagecount + " 页 " + dbcount + " 条记录 当前第 " + curpage + " 页 <a href='" + url + ".aspx?page=0'>首 页</a> <a href='" + url + ".aspx?page=" + prepage + "'>上一页</a> <a href='" + url + ".aspx?page=" + nextpage + "'>下一页</a> <a href='" + url + ".aspx?page=" + (pagecount - 1) + "'>尾 页</a>";
return pagestr;
}