Recently contacted Mvcpager to make a note.
In fact, I like the front and back end of the separation, paging this thing is responsible for the end of the place, the back end without consultants, here Mvcpager a bit reminds me of the server control, after all, the use of HtmlHelper.
But it's very convenient. We used to write pagination, the backend will encapsulate a page<t> class, now we can use Mvcpager to provide us with good pagelist<t>, the function is a bit similar, but Mvcpager function to be powerful.
First, use Mvcpager this control, need the following support
1. Back-end MvcPager.dll references:
2. Front end needs Css:pagerstyles.css, as well as other theme style pictures (PS: My demo is used bootstrap) Js:jq,jquery.unobtrusive-ajax.min.js,mvcpager.js ( PS: Synchronous paging does not require all references, asynchronous paging is required to refer to, here we will first refer to the HA)
Second, using the method provided by Mvcpager Topagelist for paging query, take out the data, return to the front desk to display
This returns the Pagelist<userinfo> object to the foreground of the strongly typed view, notice here the form of the method= "get", because the page bar link is based on the URL to access the background, the search parameters are passed through the URL, If it becomes post, the search function will be invalidated.
The main is this picture, set the code of the page bar, here to use the Mvcpager paging function, is the extension of the HtmlHelper.
Three