public string strHTML {get; set;}
public int PageCount {get; set;}
public int PageIndex {get; set;}
public string Strpagebar {get; set;}
protected void Page_Load (object sender, EventArgs e)
{
USERINFOBLL BLL = new USERINFOBLL ();
int pageIndex;
int PageCount = BLL. Getpagecount (10);//Get Total pages
PageCount = pagecount;//to previous total pages
if (!int. TryParse (request.querystring["PageIndex"], out pageIndex)//Get page number, first time empty
{
The first time I loaded
PageIndex = 1;
}
Determine the value of a pageindex
PageIndex = PageIndex < 1? When 1:pageindex;//is less than 1
PageIndex = pageIndex > PageCount? When pagecount:pageindex;//is greater than the total number of pages
PageIndex = pageindex;//passed to the previous paragraph current page
Query the data to be displayed on the current page based on the page number passed in.
list<userinfomoldel> list = BLL. Getthispagelist (PageIndex, 10);//query user data by page number
StringBuilder sb = new StringBuilder ();
foreach (Userinfomoldel userinfo in list)
{
Sb. AppendFormat ("<li><span>{0}</span><a href= ' newlist.aspx ' target= ' _blank ' >{1}</a> </li> ", UserInfo. Regtime,userinfo. Username+ "===>" +userinfo. USERPWD);
}
strHTML = sb. ToString ();//concatenation of strings
Userinfocommon.pagebar PB = new Userinfocommon.pagebar ();//display of Digital page bar
strpagebar= PB. Getpagebar (PageIndex, PageCount);
}
07asp.net==== Sub-page