日期:2014-05-19  浏览次数:20522 次

Repeater下分页怎么做呢,
有个AspNetPager控件,但是不知道怎么用,有使用过并在Repeater下分页的朋友指点下哦,谢谢了

------解决方案--------------------
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = ds.Tables[0].DefaultView;
objPds.AllowPaging = true;
objPds.PageSize = 5;
int CurPage;
if (Request.QueryString[ "Page "] != null)
CurPage=Convert.ToInt32(Request.QueryString[ "Page "]);
else
CurPage=1;

objPds.CurrentPageIndex = CurPage-1;
lblCurrentPage.Text = "当前页: " + CurPage.ToString();

if (!objPds.IsFirstPage)
lnkPrev.NavigateUrl=Request.CurrentExecutionFilePath + "?Page= " + Convert.ToString(CurPage-1);

if (!objPds.IsLastPage)
lnkNext.NavigateUrl=Request.CurrentExecutionFilePath+ "?Page= " + Convert.ToString(CurPage+1);

Repeater1.DataSource=objPds;
Repeater1.DataBind();