BootStrap mvcpager分页样式(get请求,刷新页面)
使用方法:
先把mvcpager.dll引用加入mvc项目中。
前台代码
前台:
@{ Layout = null; } @using Webdiyer.WebControls.Mvc @model PagedList<string> <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Index</title> <link href="~/Content/css_pager.css" rel="stylesheet" /> </head> <body> <div> @foreach (var item in Model) { @item<br /> } </div> <div style="text-align:center;"> @Html.Pager(Model, new PagerOptions { PageIndexParameterName = "pageIndex", ContainerTagName = "ul", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", PagerItemsSeperator = "", CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a href=\"#\">{0}</a></li>", PagerItemWrapperFormatString = "<li>{0}</li>" }, new { id = "bootstrappager", @class = "pagination" }) <!-- @class 可为pagination或pager 样式可自行修改样式表--> </div> </body> </html>
后台代码
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Webdiyer.WebControls.Mvc; namespace MvcApplication6.Controllers { public class HomeController : Controller { // // GET: /Home/ public ActionResult Index(int pageIndex=1, int pageSize=2) { List<string> list = new List<string>(){ "a", "b", "c", "d" }; return View(list.ToPagedList(pageIndex, pageSize)); } } } @Html.Pager(Model, new PagerOptions { PageIndexParameterName = "pageIndex", ContainerTagName = "ul", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", PagerItemsSeperator = "", CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a href=\"#\">{0}</a></li>", PagerItemWrapperFormatString = "<li>{0}</li>" }, new { id = "bootstrappager", @class = "pagination" })
样式更改:class为pager或pagination
如图:
样式文件:
.pagination { border-radius: 4px; display: inline-block; margin: 20px 0; padding-left: 0; } .pagination > li { display: inline; } .pagination > li > a, .pagination > li > span { background-color: #fff; border: 1px solid #ddd; color: #337ab7; float: left; line-height: 1.42857; margin-left: -1px; padding: 6px 12px; position: relative; text-decoration: none; } .pagination > li:first-child > a, .pagination > li:first-child > span { border-bottom-left-radius: 4px; border-top-left-radius: 4px; margin-left: 0; } .pagination > li:last-child > a, .pagination > li:last-child > span { border-bottom-right-radius: 4px; border-top-right-radius: 4px; } .pagination > li > a:hover, .pagination > li > span:hover, .pagination > li > a:focus, .pagination > li > span:focus { background-color: #eee; border-color: #ddd; color: #23527c; z-index: 3; } .pagination > .active > a, .pagination > .active > span, .pagination > .active > a:hover, .pagination > .active > span:hover, .pagination > .active > a:focus, .pagination > .active > span:focus { background-color: #337ab7; border-color: #337ab7; color: #fff; cursor: default; z-index: 2; } .pagination > .disabled > span, .pagination > .disabled > span:hover, .pagination > .disabled > span:focus, .pagination > .disabled > a, .pagination > .disabled > a:hover, .pagination > .disabled > a:focus { background-color: #fff; border-color: #ddd; color: #777; cursor: not-allowed; } /*.pagination-lg > li > a, .pagination-lg > li > span { font-size: 18px; line-height: 1.33333; padding: 10px 16px; } .pagination-lg > li:first-child > a, .pagination-lg > li:first-child > span { border-bottom-left-radius: 6px; border-top-left-radius: 6px; } .pagination-lg > li:last-child > a, .pagination-lg > li:last-child > span { border-bottom-right-radius: 6px; border-top-right-radius: 6px; } .pagination-sm > li > a, .pagination-sm > li > span { font-size: 12px; line-height: 1.5; padding: 5px 10px; } .pagination-sm > li:first-child > a, .pagination-sm > li:first-child > span { border-bottom-left-radius: 3px; border-top-left-radius: 3px; } .pagination-sm > li:last-child > a, .pagination-sm > li:last-child > span { border-bottom-right-radius: 3px; border-top-right-radius: 3px; }*/ .pager { list-style: outside none none; margin: 20px 0; padding-left: 0; text-align: center; } .pager li { display: inline; } .pager li > a, .pager li > span { background-color: #fff; border: 1px solid #ddd; border-radius: 15px; display: inline-block; padding: 5px 14px; text-decoration: none; } .pager li > a:hover, .pager li > a:focus { background-color: #eee; text-decoration: none; } .pager .next > a, .pager .next > span { float: right; } .pager .previous > a, .pager .previous > span { float: left; } .pager .disabled > a, .pager .disabled > a:hover, .pager .disabled > a:focus, .pager .disabled > span { background-color: #fff; color: #777; cursor: not-allowed; } .pager > .active > a, .pager > .active > span, .pager > .active > a:hover, .pager > .active > span:hover, .pager > .active > a:focus, .pager > .active > span:focus { background-color: #eee; cursor: default; z-index: 2; }
以上所述是小编给大家介绍的BootStrap mvcpager分页样式(get请求,刷新页面),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!
上一篇:快速解决C# android base-64 字符数组的无效长度问题
栏 目:C#教程
下一篇:C#开发教程之ftp操作方法整理
本文标题:BootStrap mvcpager分页样式(get请求,刷新页面)
本文地址:https://www.xiuzhanwang.com/a1/C_jiaocheng/6328.html
您可能感兴趣的文章
- 01-10适用于WebForm Mvc的Pager分页组件C#实现
- 01-10基于mvc5+ef6+Bootstrap框架实现身份验证和权限管理
- 01-10C# 封装HtmlHelper组件:BootstrapHelper
- 01-10winform分页控件 附源码下载
- 01-10C#构建分页应用的方法分析
- 01-10C# DataTable分页处理实例代码
- 01-10C#实现分页组件的方法
- 01-10C#中实现插入、删除Excel分页符的方法
阅读排行
本栏相关
- 01-10C#通过反射获取当前工程中所有窗体并
- 01-10关于ASP网页无法打开的解决方案
- 01-10WinForm限制窗体不能移到屏幕外的方法
- 01-10WinForm绘制圆角的方法
- 01-10C#实现txt定位指定行完整实例
- 01-10WinForm实现仿视频播放器左下角滚动新
- 01-10C#停止线程的方法
- 01-10C#实现清空回收站的方法
- 01-10C#通过重写Panel改变边框颜色与宽度的
- 01-10C#实现读取注册表监控当前操作系统已
随机阅读
- 01-10使用C语言求解扑克牌的顺子及n个骰子
- 08-05dedecms(织梦)副栏目数量限制代码修改
- 01-10C#中split用法实例总结
- 01-10delphi制作wav文件的方法
- 08-05DEDE织梦data目录下的sessions文件夹有什
- 01-11ajax实现页面的局部加载
- 04-02jquery与jsp,用jquery
- 01-11Mac OSX 打开原生自带读写NTFS功能(图文
- 08-05织梦dedecms什么时候用栏目交叉功能?
- 01-10SublimeText编译C开发环境设置