Detailed explanation of the use of ASP.NET synchronous paging MvcPager

高洛峰
Release: 2016-12-10 09:11:57
Original
1492 people have browsed it

I recently came into contact with MvcPager, let me take a note

Actually, I like the separation of front-end and back-end. The front-end is responsible for things like paging, and the back-end does not need a consultant. The MvcPager here reminds me a bit of server control. After all, HtmlHelper is used .

But it’s very convenient. . In the past, when we wrote paging, the backend would encapsulate a Page class. Now we can use MvcPager to provide us with a good PageList. The function is somewhat similar, but the function of MvcPager is more powerful.

1. To use the MvcPager control, you need the following support

1. Backend MvcPager.dll reference:

Detailed explanation of the use of ASP.NET synchronous paging MvcPager

2. The front end requires Css: pagerstyles.css, and other theme style pictures, etc. (PS: My Demo Bootstrap is used) Js: Jq, jquery.unobtrusive-ajax.min.js, MvcPager.js (PS: Synchronous paging does not need to be quoted in full, asynchronous paging does need to be quoted, here we will quote it first)

Detailed explanation of the use of ASP.NET synchronous paging MvcPager

Second, use the method ToPageList provided by MvcPager to perform paging query, retrieve the data, and return it to the front desk for display

Detailed explanation of the use of ASP.NET synchronous paging MvcPager

Here, the PageList object is returned to the strong type view of the front desk. Pay attention to the method= of the form here. "Get", because the link of the paging bar is based on the URL to access the backend, and the search parameters are brought through the URL. If it is changed to post, the search function will be invalid.

Detailed explanation of the use of ASP.NET synchronous paging MvcPager

Detailed explanation of the use of ASP.NET synchronous paging MvcPager

Mainly this picture, the code for setting the paging bar. The paging function of MvcPager is used here, which is an extension of HtmlHelper.

Detailed explanation of the use of ASP.NET synchronous paging MvcPager

3. Rendering

Detailed explanation of the use of ASP.NET synchronous paging MvcPager


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template