[C#] mvc分页 →→→→→进入此内容的聊天室

来自 , 2019-03-18, 写在 C#, 查看 132 次.
URL http://www.code666.cn/view/7180cffd
  1.   <ul>
  2.         @foreach (var item in Model)
  3.         {
  4.             string title;
  5.             title = item.Title;
  6.  
  7.             <li class="clearfix"><span>@Html.DisplayFor(modelItem => item.WriteTime)</span> @Html.ActionLink(title, "Details", new { id = item.ArticleID })
  8.                 @if (ViewBag.username != "")
  9.                 { <div class="ArticleEidt-Show beforlogin">@Html.ActionLink("编辑", "Edit", new { id = item.ArticleID })
  10.                            @Html.ActionLink("删除", "Delete", new { id = item.ArticleID })</div>}
  11.             </li>                          
  12.         }
  13.     </ul>
  14.     <div class="pageOptions">
  15.         @Html.Pager(Model, new PagerOptions
  16.                {
  17.                    PageIndexParameterName = "id",
  18.                    ShowPageIndexBox = true,
  19.                    FirstPageText = "首页",
  20.                    PrevPageText = "上一页",
  21.                    NextPageText = "下一页",
  22.                    LastPageText = "末页",
  23.  
  24.                    PageIndexBoxType = PageIndexBoxType.TextBox,
  25.  
  26.                    PageIndexBoxWrapperFormatString = "<p>请输入页数:{0}</p>",
  27.  
  28.                    GoButtonText = "转到"
  29.                })
  30.     </div>
  31.         public ActionResult Systems(int? id = 1)
  32.         {
  33.             UserCheck();
  34.             ArticleDAL ADAL = new ArticleDAL();
  35.             int page = (int)id;
  36.  
  37.             int total = 0;
  38.             var List = ADAL.GetArticleByPredicate("Type=@0", new Object[] { 3 }, "Type", 0, 0, ref total);
  39.             var pagelist = List.AsQueryable().ToPagedList((int)page, 10);
  40.             pagelist.TotalItemCount = total;
  41.             pagelist.CurrentPageIndex = (int)(page);
  42.             return View(pagelist);
  43.         }
  44.  
  45.  

回复 "mvc分页"

这儿你可以回复上面这条便签

captcha