Paging Control X.PAGEDLIST.MVC

Source: Internet
Author: User

There are several ways to page out in ASP. But the most widely used on NuGet is paging with pagedlist and X.PAGEDLIST.MVC. (formerly known as: PAGEDLIST.MVC, but beginning in 2014, the author renamed the Project Name "X.pagedlist.mvc"), with this plugin will be very convenient, you can try, next will tell you how to install this NuGet plugin.

ASP 5 uses X.PAGEDLIST.MVC for paging tutorials (formerly known as PAGEDLIST.MVC)

1. Tool--nuget Package Manager--NuGet package for management solution

2, search "X.pagedlist.mvc", and install, reference

3, \controllers\usercontroller.cs Background code basic usage:

using pagedlist;  Public ActionResult Index (int1) {  constint;   var iusers = db. Users.orderby (p = p.id). Topagedlist (page, pageSize);   return View (iusers);}

4, \views\user\index.cshtml Front code basic usage:

@using pagedlist@using Pagedlist.mvc Class= "Table" > xxxxxxxx xxxx </table>new {page})

5, \app_start\routeconfig.cs configuration:

 Public class routeconfig{  publicstaticvoid  registerroutes (routecollection routes)  {    routes. Ignoreroute ("{resource}.axd/{*pathInfo}");    Routes. MapRoute (      name: "Default",      URL: "{controller}/{action}/{page}",      new { Controller = "User", action = "Index", page = urlparameter.optional}    );}  }

6.:

I did not achieve the effect of the original author, because I am mvc4, and that control on the page property Ah, is to be higher version, so there is

Compiler Error Message: CS1705: Assembly "X.pagedlist.mvc, version=4.8.0.38135, culture=neutral, publickeytoken=abbb863e9397c5e1" used System.Web.WebPages, version=3.0.0.0, Culture=neutral, publickeytoken=31bf3856ad364e35 "version higher than referenced assembly" System.Web.WebPages, version=2.0.0.0, Culture=neutral, publickeytoken=31bf3856ad364e35 "version

This version of the issue or download update is better

Immediately following the appearance

Attempt to access security-critical method failed

The Final Solution is:

1 install-packagewebmatrix.data2 install-3 update-package

VS Console Install These can, right-click Add sometimes problems, it is recommended to add this.

This problem mainly exists in Mvc4 to MVC5 when the version is incompatible, report what is wrong, we go to solve, this is not the value of the programmer exist?

Paging Control X.PAGEDLIST.MVC

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.