Code using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
publicpartialclass p : System.Web.UI.Page { protectedvoid Page_Load(object sender, EventArgs e) { int p = Convert.ToInt32(Request.QueryString["p"]); string content ="第一页{nextpage}第二页{nextpage}第三页"; string url="?id=1&"; aspxsky_pagecur(p, url, content); } publicvoid aspxsky_pagecur(int p, string url,string str) { string[] arr = System.Text.RegularExpressions.Regex.Split(str, "{nextpage}"); if (p <=0) { p =1; } if (p > arr.Length) { p = arr.Length; } string mystr = arr[(p -1)] +"<br><br><center>"; for (int i =0; i < arr.Length; i++) { if (i+1== p) { mystr += p +" "; } else { mystr +="<a href='"+ url +"p="+ (i +1) +"'>["+ (i +1) +"]</a> "; } } content.Text = mystr+"</center>"; } }