我有一个页面,我使用 Nuget 包 pagedlist.mvc 3.0.18(MVC3 的最新版本)。问题是,当我列出页面时,它会使我的页面变成一个看起来像
而不是 < 1,2,3,4,5,6,7.. >
我的观点看起来像
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IPagedList<News>>" %>
<%@ Import namespace="PagedList" %>
<%@ Import namespace="PagedList.Mvc" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<table>
<tr>
<td>
<% foreach (var v in Model)
{%>
<%: v.Content %><br />
<%: v.DateCreated %><br />
<%: v.Email %><br />
<%} %>
<h2>News</h2>
<%: Html.PagedListPager(Model, page => Url.Action("News", new { page }), PagedListRenderOptions.Minimal)%>
后面的代码看起来像
public ActionResult News(int? page)
{
List<News> products = HomeBLL.GetNewsList(); //returns IQueryable<Product> representing an unknown number of products. a thousand maybe?
var pageNumber = page ?? 1; // if no page was specified in the querystring, default to the first page (1)
var onePageOfProducts = products.ToPagedList(pageNumber, 25); // will only contain 25 products max because of the pageSize
ViewBag.OnePageOfProducts = onePageOfProducts;
return View(onePageOfProducts);
}
关于什么可能是错的任何建议?标准的 CSS 也包括在内。