C# MVC分页视图

视图

    
共 @Model.TotalPageCount 页 @Model.TotalItemCount 条记录,当前为第 @Model.CurrentPageIndex 页 @Ajax.Pager(Model, new PagerOptions { /* * 设置分页显示的样式 */ FirstPageText = "首页", LastPageText = "最后一页", NextPageText = "下一页", PrevPageText = "上一页", PageIndexParameterName = "pare", ContainerTagName = "ul", CssClass = "pagination", CurrentPagerItemTemplate = "
  • {0}
  • ", DisabledPagerItemTemplate = "
  • {0}
  • ", PagerItemTemplate = "
  • {0}
  • " }, new MvcAjaxOptions { HttpMethod = "post", UpdateTargetId = "DataList",//更新数据的标签ID DataFormId = "form0" //分页对应的条件搜索表单ID })

    控制器

     public ActionResult Index(int pare=1)
            {
            string json = GetApiResult("get", "GetBlurb");
            //将json反序列化成泛型集合
            List
                list = JsonConvert.DeserializeObject>(json);
                return View(list.ToPagedList(pare,3));
    
        }
    

    你可能感兴趣的:(C# MVC分页视图)