Paramnametotal total number of records paramparamparamnameper number of records per page paramparamnamepage current page paramparamnamequery_stringUrl parameter param returns a paging style (string) privatestringPagination (inttotal, intpe
/// Param name = "total" number of records/param // param name = "per" number of records per page/param // param name = "page" Current page /param // param name = "query_string" Url parameter/param // return a paging style (string) with HTML code) private string Pagination (int total, int pe
///Total number of records
///Number of records per page
///Current page number
///Url parameters
/// Return a paging style (string) with HTML code)
Private string Pagination (int total, int per, int page, string query_string)
{
Int allpage = 0;
Int next = 0;
Int pre = 0;
Int startcount = 0;
Int endcount = 0;
String pagestr = "";
If (page <1) {page = 1 ;}
// Calculate the total number of pages
If (per! = 0)
{
Allpage = (total/per );
Allpage = (total % per )! = 0? Allpage + 1: allpage );
Allpage = (allpage = 0? 1: allpage );
}
Next = page + 1;
Pre = page-1;
Startcount = (page + 5)> allpage? Allpage-9: page-4; // The start Number of the intermediate page
// End number of the intermediate page
Endcount = page <5? 10: page + 5;
If (startcount <1) {startcount = 1;} // to avoid negative output, if it is smaller than 1, it starts from number 1.
If (allpage <endcount) {endcount = allpage;} // the possibility of page number + 5 will generate the final output sequence number greater than the total page number, then it should be controlled within the number of pages
Pagestr = "Total" + allpage + "page/page +" page ";
// Intermediate page processing, which increases the time complexity and reduces the space complexity
For (int I = startcount; I <= endcount; I ++)
{
Pagestr + = page = I? "" + I + "": "" + I + "";
}
Return pagestr;
}