Giter Site home page Giter Site logo

leafney.pager's Introduction

#Leafney.Pager ASP.NET MVC分页插件

  1. 支持URL参数分页和MVC路由参数分页
  2. 支持自定义分页参数,默认为page
  3. 支持自定义分页效果样式
  4. 支持响应式分页,能自适应PC端和移动端的显示效果
  5. Demo: 人生就是不断的打怪升级

Test

通过URL参数分页

int total = 0;
//查询分页数据
var _list = new MakeData().GetPageList(Datacount, page, 10, out total);
//填充分页控件
PageList<Article> pagelist = new PageList<Article>(_list, page, 10, total);

return View(pagelist); 

通过路由规则方式分页

####调用:

int total = 0;
//查询分页数据 (分页参数设置为p)
var _listR = new MakeData().GetPageList(Datacount,p,10,out total);
//填充分页控件
PageList<Article> pagelistR = new PageList<Article>(_listR,p,10,total);
return View(pagelistR);

####自定义路由规则: //自定义分页插件路由规则 //在Global文件中注册自定义分页路由规则 public static void RegisterRoutesFenYe(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{pathInfo}"); //routes.AppendTrailingSlash = true;//是否在生成的Url末尾添加/ 斜线(如果没有存在的话) //routes.LowercaseUrls = true;//实现生成的Url小写 routes.MapRoute( name: "RouteFY", url: "{controller}/{action}/{p}/{id}", defaults: new { controller = "Home", action = "Index", p = 1, id = UrlParameter.Optional }, constraints: new { p = @"[\d]" }//p只能是数字 分页参数page可以自定义,这里设置为p,注意在页面中要指定 ); }

####在Global.asax 文件中注册自定义路由规则 //在默认路由规则之前注册自定义分页插件的路由规则 RouteConfig.RegisterRoutesFenYe(RouteTable.Routes);


需要添加对System.Web.Mvc.dll的引用

leafney.pager's People

Contributors

leafney avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.