Copy codeThe Code is as follows:
Public void listArticle ()
{
CmsArticle arObj = new CmsArticle ();
DataSet ds = arObj. listArticle ();
If (ds! = Null)
{
PagedDataSource PPS = new PagedDataSource ();
Pds. DataSource = ds. Tables [0]. DefaultView;
PPS. AllowPaging = true;
PPS. PageSize = 1;
Pds. CurrentPageIndex = currentpage-1;
RsCount = ds. Tables [0]. Rows. Count;
PageCount = PPS. PageCount;
Pagesize = PPS. PageSize;
GvNewList. DataSource = pds;
GvNewList. DataBind ();
/// Up/down
Double result;
Result = rsCount/pagesize;
String [] r = new string [2];
R = result. ToString (). Split ('.');
PageCount = Convert. ToInt32 (r [0]);
If (result> pageCount)
{
PageCount = pageCount + 1;
}
/// Previous page and homepage
If (! PPS. IsFirstPage)
{
LnkPrev. NavigateUrl = "? Page = "+ Convert. ToString (currentpage-1 );
// LnkHead. NavigateUrl = "? Page = "+ Convert. ToString (1 );
}
/// Next and last pages
If (! PPS. IsLastPage)
{
LnkNext. NavigateUrl = "? Page = "+ Convert. ToString (currentpage + 1 );
// LnkEnd. NavigateUrl = "? Page = "+ Convert. ToString (rsCount );
}
}
ListInfoLabel. Text = "all" + rsCount + ", per page" + pagesize + ", current section" + currentpage + "/" + pageCount + "page ";
PageInfoLiteral. Text = WebApp. Pagination. Show (currentpage, pageCount, 10 ,"? Page = ","");
}