One, the reference CSS and JS:
<href= "/content/plugins/jquery.pagination_v2.2/pagination.css" rel = "stylesheet" type= "text/css"/><src= "/content/ Plugins/jquery.pagination_v2.2/jquery.pagination.js " type=" Text/javascript " ></script>
View Code
Second, HTML:
<id= "Pagination" class= "Flickr" style= " margin-top:10px; margin-left:10px; " > </ Div >
View Code
Third, JS:
$(function () { varTotal = parseint ("@ (viewbag.total)"); varpage = parseint ("@ (viewbag.page)")-1; varPageSize = parseint ("@ (viewbag.pagesize)"); $("#Pagination"). Pagination (Total, {callback:function(page_id) {window.location= "Boardlist?page=" + page_id + "&pagesize=" + This. Items_per_page; }, //Pagecallback () calls the secondary function for page flipping. Prev_text: "Prev", Next_text:"Next Page", Items_per_page:10,//number of data per pageNum_display_entries:1,//number of page entries on both sidesCurrent_page:page,//Current page numberNum_edge_entries:11//number of page entries in the main part of a continuous page });});
View Code
Four, backstage code:
PublicActionResult boardlist () {Pagermodel pager=NewPagermodel (); if(request["page"] ==NULL) {Pager.page=1; Pager.rows=Ten; 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 (refPager); List<BoardModel> boardlist = Pager.result asList<boardmodel>; viewdata["boardmodellist"] =boardlist; Viewbag.page=Pager.page; Viewbag.total=pager.totalrows; Viewbag.pagesize=pager.rows; returnView ();}#endregion
View Code
JQuery pagination use of pagination plug-ins