Online already uses ASP to display code on the article content paging, I have no time detailed research. Today, a few long articles have been released. In order to facilitate the browsing of netizens, they will write down the following code. Because our program is written in c # .net, about C # this example, the data online is also found; so there is only to start analysis from the program structure, but the program is used for a long time, and sweat! Insufficient, please give pointers, what a better way is there, please tell us.
Display content part:
// Source: Network Empire (wren.cn/wrclub.net)// Author: Fuxing // define variables int i, start, stop, t, stat, statt, pp, pagecount, pagesize; // initial value of the variable stat = 0; Statt = 0; START = 0; // Start the string position of the query, initial 0Stop = 0; Pagesize = 2000; // Define at least the number of strings per page will be displayed. PageCount = 0;
// Get the current number of pages PA = Request.Params ["PAGE"]; if (PA == "|| PA == NULL) PA =" 1 "; PP = Convert.TOINT32 (PA);
// Get content articles = RS ["contenttxt"]. TOSTRING ();
/ / Decision Length is greater than the defined number of strings at least the number of strings IF (Articles) // if it is greater than the number of strings, we can display {t = articles = articles; = PageSize; / / Get a rough total page number / / According to the current number of pages currently (i = 0; i
String html; // Define the paging code variable
IF (PageCount> 1) // We display pages when the number of pages is greater than 1
{
For (i = 1; i <= pagecount; i )
{
IF (i == pp) // If it is a current page, bold display
HTML = " [" i "] b>";
Else
HTML = " [" i "]
}
IF (PP 1> PageCount) // Show next page, easy to browse
HTML = " [Next] p>;
Else
HTML = " [next page] p>;}
You can join the above code! If you have any questions, please go to the Net Forum Postage, address: http://bbs.wrclub.net