Use of the jQuery Pagination paging plug-in, jquerypagination

Source: Internet
Author: User

Use of the jQuery Pagination paging plug-in, jquerypagination

I. Reference CSS and JS:

<Link href = "/Content/Plugins/jQuery. pagination_v2.2/pagination.css "rel =" stylesheet "type =" text/css "/> <script src ="/Content/Plugins/jQuery. pagination_v2.2/jquery. pagination. js "type =" text/javascript "> </script>View Code

Ii. HTML:

<Div id = "Pagination" class = "flickr" style = "margin-top: 10px; margin-left: 10px;"> </div>View Code

Iii. JS:

$ (Function () {var total = parseInt ("@ (ViewBag. total) "); var page = parseInt (" @ (ViewBag. page) ")-1; var pageSize = parseInt (" @ (ViewBag. pageSize) "); $ (" # Pagination "). pagination (total, {callback: function (page_id) {window. location = "BoardList? Page = "+ page_id +" & pageSize = "+ this. items_per_page;}, // PageCallback () is the page turning function called. Prev_text: "Previous page", next_text: "Next page", items_per_page: 10, // number of data entries on each page num_display_entries: 1, // number of entries on both sides of the first and last pages current_page: page, // The current page number num_edge_entries: 11 // The number of pagination entries of the continuous paging subject part });});View Code

Iv. Background code:

Public ActionResult BoardList () {PagerModel pager = new PagerModel (); if (Request ["page"] = null) {pager. page = 1; pager. rows = 10; pager. sort = "Id"; pager. order = "desc";} else {pager. page = int. parse (Request ["page"]) + 1; pager. rows = int. parse (Request ["pageSize"]); pager. sort = "Id"; pager. order = "desc";} boardManageService. getList (ref pager); List <BoardModel> boardList = pager. result as List <BoardModel>; ViewData ["BoardModelList"] = boardList; ViewBag. page = pager. page; ViewBag. total = pager. totalRows; ViewBag. pageSize = pager. rows; return View () ;}# endregionView Code

 

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.