Asp.net content Paging

Source: Internet
Author: User
# Region paging class
/// <Summary>
/// Pagination
/// </Summary>
Public class SplictPage
{
/// <Summary>
/// Content Paging
/// </Summary>
/// <Param name = "content"> the content marker is a paging id </param>
/// <Param name = "Id"> Id </param>
/// <Returns> </returns>
Public static string bind (string content, string Id)
{
String [] temp = content. Trim (). Split ('alipay ');
 
String html = "<Table> <tr> ";
Int page;
If (system. Web. httpcontext. Current. Request. querystring ["page"] = NULL)
{
HTML + = "<TD>" + temp [0] + "</TD> </tr> </table> ";
}
Else
{
If (SFL. forsdk. Validate. isint (system. Web. httpcontext. Current. Request. querystring ["page"])
{
Page = int. parse (system. Web. httpcontext. Current. Request. querystring ["page"]);
}

Else
{
System. Web. HttpContext. Current. Response. Write ("<script> alert ('input parameter error! '); History. back (); </script> ");
System. Web. HttpContext. Current. Response. End ();
Page = 0;
}
If (int. Parse (System. Web. HttpContext. Current. Request. QueryString ["page"])> temp. Length)
{
System. Web. HttpContext. Current. Response. Write ("<script> alert ('the input parameter exceeds the maximum page number! '); History. back (); </script> ");
System. Web. HttpContext. Current. Response. End ();
Page = 0;
}
Html + = "<td>" + temp [page-1] + "</td> </tr> </table> ";

}
String thispage = "";
If (temp. Length> 1)
{
Thispage = "<table align = center> <tr> <td> [<a href =? Kid = "+ Id +" & page = 1> homepage </a>] </td> ";


For (int I = 0; I <= temp. Length-1; I ++)
{
Thispage + = "<td> [<a href =? Kid = "+ Id +" & page = "+ (I + 1) +"> "+ (I + 1) +" </a>] </td> ";
}

Thispage + = "<td> <a href =? Kid = "+ Id +" & page = "+ (temp. Length) +"> [last page] </td> </tr> </table> ";
}
Return html + thispage;
}

}
# Endregion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.