MVC paging control and mvc Paging
:
Figure 1
Tip: The data is a good data collection software that has been studied before <>. It collects user feedback from a game forum.
So how should I implement this paging for my website? Very easy! See
Step 1: Add reference (dll and source code will be attached later)
Step 2: convert data to the IPagedList <T> type
Figure 2
Step 3: add strong types, add paging references, and add pagination styles (22 Styles! For your choice, you can use the BarStyle enumeration to select a style)
Figure 3
Ps: parameter description
This. Html Concatenates the url of other pages for the obtained path
ViewData. Model is used to obtain the current page, the total number of pages, used to generate a page list
BarStyle. xxxx is a paging control style. There are 22 types, which are always suitable for you.
5 is the number of items displayed before and after the current page. 1. The current page is 8th pages. 5 items are displayed before and after the current page.
This control is not compiled by myself, but is optimized on the original basis. The optimization items are as follows:
1. Change the false page to a real page
2. Delete redundant code
3. Optimize code Logic
4. Fixed some bugs.
Click to download source code
Password: 960r
The pagelist page control is used for Aspnet Mvc query. When the next page is clicked, how can the query conditions be passed in?
ASP. net mvc does not require server controls. We generally write paging functions by ourselves, which is not complex and simple. Just use the simple computation with Linq.
Aspnet MVC3 achieves paging Effect
Paging, in fact, MVC is tied to link to call the background action. Therefore, you only need to add a page with the parameter on the page button, and query the page with the parameter when you go to the action, put it back into a view.
I cannot describe it clearly. You can check the buttons on Baidu pages. In fact, there is a parameter in the link that indicates the page number, and you will know how to paging.