1
 <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="PagedList.Mvc" %>
<%@ Import Namespace="PagedList" %>

<!DOCTYPE html>`enter code here`

<html>
<head runat="server">
    <title>ViewPage1</title>
    <link href="../../Public/css/PagedList.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div>
        <table class="tableEmptyStyle">
        <tr>

        </tr>
    </table>
    <table>
        <tr>          
            <th>
                Code
            </th>
            <th>
                Name
            </th>            
        </tr>
        <%            
            foreach (var item in ViewBag.OnePageDivisions)
           { %>
        <tr>
           <td>
                <%: item.Code %>
            </td>
            <td>
                <%: item.Name %>
            </td>
         </tr>
        <% Html.PagedListPager((IPagedList)ViewBag.OnePageDivisions, page => Url.Action("Index", new { page = page }), PagedListRenderOptions.PageNumbersOnly); %>
        <% } %>        
    </table>

然后从控制器我得到列表和

ViewBag.OnePageDivisions = allList

我能够获取列表并显示它,

问题是下面的页码没有显示。

CSS,“PagedList.css”是从包中获取的。任何帮助表示赞赏

我正在使用 MVC 3、PagedList 1.15.0.0 和 PagedList.Mvc 3.18.0.0

4

1 回答 1

1

改变

<% Html.PagedListPager((IPagedList)ViewBag.OnePageDivisions, page => Url.Action("Index", new { page = page }), PagedListRenderOptions.PageNumbersOnly); %>

<%: Html.PagedListPager((IPagedList)ViewBag.OnePageDivisions, page => Url.Action("Index", new { page = page }), PagedListRenderOptions.PageNumbersOnly) %>
于 2013-07-22T08:53:28.987 回答