MvcPager Demo (synchronous paging), mvcpagerdemo
Recently I came into contact with MvcPager, Ang... Take a note.
In fact, I like frontend and backend separation. The frontend is responsible for paging, and no consultant is needed at the backend. The MvcPager here reminds me of the server control. After all, HtmlHelper is used.
But it is quite convenient .. In the past, when we write pages, the backend will encapsulate a Page <T> class. Now we can use MvcPager to provide us with a good PageList <T>. The function is a bit similar, but MvcPager must be powerful.
I. Using the MvcPager control requires the following support:
1. backend MvcPager. dll reference:
2. front-end Css: pagerstyles.css, and other theme style images (PS: My Demo uses bootstrap) Js: Jq, jquery. unobtrusive-ajax.min.js, MvcPager. js (PS: Synchronous pages do not need to be referenced in whole. asynchronous pages need to be referenced. Here we will reference them first)
2. Use the ToPageList method provided by MvcPager to perform paging query, retrieve the data, and return it to the foreground for display.Here, the PageList <UserInfo> object is returned to the strong-type view on the foreground. Note that the form method is "get" here, because the links to the paging entries are url-based to access the background, the search parameters are all carried by url. If it is changed to post, the search function will be invalid.
This figure shows the code for setting pagination entries. The MvcPager paging function is used to expand HtmlHelper.
III,