@using PagedList.Mvc;
@model PagedList.IPagedList<MvcApplicationBootStramp.Models.Person>

@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    
    <link href="~/Content/PagedList.css" rel="stylesheet" />//记得引用这个css文件
</head>
<body>
    <table>
        <tr>
            <th>ID
            </th>
            <th>姓名
            </th>
            <th>地址
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Id)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Address)
                </td>
            </tr>
        }
    </table>
    
       @Html.PagedListPager(Model, page => Url.Action("Index", new { page }), new PagedListRenderOptions() { LinkToFirstPageFormat = "首页", LinkToNextPageFormat = "下一页", LinkToPreviousPageFormat = "上一页", LinkToLastPageFormat = "末页",DisplayItemSliceAndTotal=true, ItemSliceAndTotalFormat="共有{2}页", MaximumPageNumbersToDisplay=6})  //{2}占位符
   
</body>
</html>

// GET: /Person/
        PersonDAL person = new PersonDAL();
        public ActionResult Index(int page = 1)
        {
           
            return View(person.GetPersons().ToPagedList(page, 5));
           // return View();
        }

效果截图

PagedList 分页的更多相关文章

  1. ASP.NET MVC利用PagedList分页(二)PagedList+Ajax+JsRender

    (原文) 昨天在ASP.NET MVC利用PagedList分页(一)的 最后一节提到,一个好的用户体验绝对不可能是点击下一页后刷新页面,所以今天来说说利用Ajax+PagedList实现无刷新(个人 ...

  2. MVC无刷新查询,PagedList分页控件使用,导出Excel

    使用MVC开发也有一段时间了,总结下无刷新部分视图的使用.PagedList分页控件的使用. @using PagedList @model StaticPagedList<T> < ...

  3. PagedList分页,如何添加action参数

    使用PagedList分页,如 @Html.PagedListPager((IPagedList)Model, page => Url.Action("Index", new ...

  4. MVC使用x.PagedList分页

    MVC分页 1.Install Package Tools=> NuGet Package Manager=>Manager NuGet Packages of Solution

  5. ASP.NET MVC5 PagedList分页示例

    ASP.NET MVC是目前ASP.NET开发当中轻量级的Web开发解决方案,在ASP.NET MVC概述这篇译文当中,已经详细的介绍了ASP.NET MVC与Web Forms的区别以及各自的适用场 ...

  6. ASP.NET MVC利用PagedList分页(一)

    前几天看见博客园上有人写ASP.NET MVC的分页思想,这让我不禁想起了PagedList.PagedList是NuGet上提供的一个分页的类库,能对任何IEnumerable<T>进行 ...

  7. asp.net 中使用 pagedlist 分页并具有查询功能的实现方法

    用pagedlist在项目中做分页已N次了,今天再次用实例来实现一个带查询功能的分页例子. 1.在view代码: @using PagedList.Mvc@model BGZS.Models.User ...

  8. Asp.net Mvc使用PagedList分页

    git:https://github.com/troygoode/PagedList 1. Nuget 安装package watermark/2/text/aHR0cDovL2Jsb2cuY3Nkb ...

  9. 如何使用 PagedList.Mvc 分页

    刚开始找PagedList分页不是例子太复杂,就是写的过于简略,由于对于MVC的分页不太了解,之前使用的都是Asp.Net 第三方控件 + 数据库存储过程分页.还是老外写的例子简捷,https://g ...

随机推荐

  1. Visual Studio在页面按F7不能跳转至cs代码页的解决方法

    检查页面Page设置内的CodeBehind属性,看是否与代码页的文件名相同,不同则改正,问题得以解决.

  2. 华为oj 计算字符个数

    练手而已 #include <stdio.h> #include <string.h> int main(void) { char string[200]={'\0'}; in ...

  3. exc_bad_access(code=1, address=0x789870)野指针错误

    原因: exc_bad_access(code=1, address=0x789870)野指针错误,主要的原因是,当某个对象被完全释放,也就是retainCount,引用计数为0后.再去通过该对象去调 ...

  4. USB联机线编程接口(API)

    USB联机线编程接口(API) 2013-10-19 本页面的文字允许在知识共享 署名-相同方式共享 3.0协议和GNU自由文档许可证下修改和再使用. 关键字:USB隔离线.USB点对点通讯.USB通 ...

  5. C++Primer笔记(2)

    大型程序一般都是分为多个模块,由多人协作来进行开发的,其中还不可避免的会用到库.而各个模块代码以及库中会定义大量变量,而大量变量的命名,不可避免的会遇见“重名”的问题.“重名”的情况我们称之为命名空间 ...

  6. c#中serialPort1_DataReceived串口接收事件处理

    1.缓冲区不定字节读取(波特率很高也没问题) //Thread.sleep(1000);//处理事件这块可以加上延时确保不定数的数据可以全部收到缓冲后,才去读缓冲内容--单位:毫秒 byte[] da ...

  7. mvc上传,下载,浏览文件功能(用uploadify插件)

    类 public class UpLoadFileController : Controller { // // GET: /UpLoadFile/ public ActionResult Index ...

  8. Blogger建立新文章 - Blog透视镜

    使用Blogger,建立好Blog部落格之后,接着就是建立新文章,它是Blog部落格的灵魂,先从简单开始,来了解建立新文章的标题,文章中如何上传图片,建立卷标,及设定排程日期,定时自动发布等这些功能, ...

  9. hdu 1142 A Walk Through the Forest

    http://acm.hdu.edu.cn/showproblem.php?pid=1142 这道题是spfa求最短路,然后dfs()求路径数. #include <cstdio> #in ...

  10. LeetCode_Recover Binary Search Tree

    Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing ...