ASP. Net paging navigation instance, asp.net paging navigation
Asp. Net pagination allows you to set the link text displayed on the front-end of the homepage, Previous Page, next page, and last page. Here we only mention simple functions, so it is more handy to thoroughly study and analyze their principles.
// The target container of the containerId navigation. The span tag is recommended. // The default url is XXX. XX? Pagenum = // the current page number of the curPage // The maximum number of segments in the maxSection (the maximum number of pages in a segment) // the total number of pages in the totalPage function Navigate (containerId, url, curPage, maxSection, totalPage) {// to the first page of the symbol var first = "| <"; // to the last page of the symbol var last = ">>| "; // Previous Page symbol var back = "<" // next page symbol var next = ">"; // illegal page number processing if (curPage> totalPage | curPage <0) {curPage = 1;} // obtain the parent element var containerObj = document of the navigation container. getElementById (containerId); // obtain the part number of the current page. Yes, it is a float type) var curSection = Math. floor (curPage-1)/maxSection + 1); // obtain the number of the last segment var lastSection = Math. floor (totalPage-1)/maxSection + 1); var html = ""; // the current page is not 1st. Add it to the home page, and if (curPage> 1) {html + = "... ";}// the first page number of the current segment var curSectionFirst = (curSection-1) * maxSection + 1; // The last page number of the current segment var curSecitonLast = curSection * maxSection; // output the page number of the current segment for (var I = curSectionFirst; I <= CurSecitonLast & I <= totalPage; I ++) {if (curPage = I) {html + = "... ";} // the current page is not the last page. Add the next page and last page symbol if (curPage! = TotalPage) {html + = "<a data-cke-saved-href =" http://blog.csdn.net/jiangpeng59/article/details/ "Href =" http://blog.csdn.net/jiangpeng59/article/details/ '"" + = "" Url = "" (curpage = "" 1) = "' =" ">" + next + ""; html + = "}
The following page navigation implementation results are obtained: | <... 9 10 11 12 13 14 15 16...> |
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.