MVC paging control and mvc Paging

Source: Internet
Author: User

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.

Related Article

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.