Copy Code code as follows:
public void Listarticle ()
{
Cmsarticle arobj = new Cmsarticle ();
DataSet ds = Arobj.listarticle ();
if (ds!= null)
{
PagedDataSource PDS = new PagedDataSource ();
Pds. DataSource = ds. Tables[0]. DefaultView;
Pds. AllowPaging = true;
Pds. PageSize = 1;
Pds. CurrentPageIndex = currentpage-1;
Rscount = ds. Tables[0]. Rows.Count;
PageCount = PDS. PageCount;
pagesize = PDS. PageSize;
Gvnewlist.datasource = PDS;
Gvnewlist.databind ();
Page 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 (!pds. Isfirstpage)
{
Lnkprev.navigateurl = "page=" + convert.tostring (currentpage-1);
Lnkhead.navigateurl = "? Page= "+ convert.tostring (1);
}
Next and last page
if (!pds. Islastpage)
{
Lnknext.navigateurl = "page=" + convert.tostring (currentpage + 1);
Lnkend.navigateurl = "? Page= "+ convert.tostring (rscount);
}
}
Listinfolabel.text = "all altogether" + Rscount + "article, each page" + pagesize + "article, the current first" + CurrentPage + "/" + PageCount + "page";
Pageinfoliteral.text = WebApp.Pagination.Show (CurrentPage, PageCount, "? page=", "");
}