ASP. Net paging navigation instance, asp.net paging navigation

Source: Internet
Author: User

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.

Related Article

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.