repeater实现分页

时间:2012-12-21 10:15:13
【文件属性】:

文件名称:repeater实现分页

文件大小:44KB

文件格式:DOC

更新时间:2012-12-21 10:15:13

asp.net 分页 repeater

repeater实现分页 //对PagedDataSource 对象的相关属性赋值 PagedDataSource objPds = new PagedDataSource(); objPds.DataSource = ds.Tables[0].DefaultView; objPds.AllowPaging = true; objPds.PageSize = 5; int CurPage; //当前页面从Page查询参数获取 if (Request.QueryString["Page"] != null) CurPage=Convert.ToInt32(Request.QueryString["Page"]); else CurPage=1; objPds.CurrentPageIndex = CurPage-1; lblCurrentPage.Text = "Page: " + 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); //把PagedDataSource 对象赋给Repeater控件 Repeater1.DataSource=objPds; Repeater1.DataBind(); }


网友评论