0
我通過NuGet
安裝了PagedList
和PagedList.Mvc
包。裏面控制器代碼PagedList沒有正確呈現
@using PagedList;
@using PagedList.Mvc;
@model IPagedList<Employee>
@{
ViewBag.Title = "ListEmployees";
}
<h3>All Employees (@ViewBag.TotalEmployees)</h3>
@if(Model.Count > 0)
{
foreach(var item in Model)
{
Html.RenderPartial("Employee.Card", item);
}
@Html.PagedListPager((IPagedList)Model, page => Url.Action("List", new { page = page }), PagedListRenderOptions.Minimal)
}
else
{
@: no records were found. Sorry
}
::然後我用它的方式
public class EmployeeController : Controller
{
private IRepository<Employee> repository;
private Int32 PageSize = 10;
public EmployeeController(IRepository<Employee> repository)
{
this.repository = repository;
}
public ActionResult List(Int32? page)
{
var set = repository.Get();
ViewBag.TotalEmployees = set.Count();
return View(set.ToPagedList(page ?? 1, PageSize));
}
}
這是很正常的無樣式的無序列表作爲一個結果。那麼我如何將自定義樣式應用於傳呼機?
謝謝!
好的。我只有一個頁面,所以'next/prev'鏈接被禁用。認爲這是罪魁禍首?但是我現在正在獲得的是沒有造型的明顯的不合格名單。這是正常的行爲,我應該適用我的風格? – lexeme 2012-04-19 12:39:08
如果你沒有包含pagedlist.css文件(或者你自己設計),這是正常的行爲, – Troy 2012-04-19 23:12:58