Yanor.net/
Wiki
Blog
GitHub
Sandbox
開始行:
* PagedList.MVC [#e6f38f4a]
- https://github.com/TroyGoode/PagedList
- http://www.nuget.org/packages/PagedList.Mvc/
** Manual Paging [#x84f11d5]
*** Controller [#c2bbdb24]
namespace WebApplication1.Controllers
{
public class HomeController : Controller
{
public ActionResult Index(int? page)
{
var pageIndex =( page ?? 1) - 1;
var pageSize = 2;
var dsn = "Server=hv-cent01;Port=5432;User Id...
var cn = new NpgsqlConnection(dsn);
cn.Open();
var count = (int) cn.Query<Int64>(@"SELECT CO...
var rows = cn.Query<MyEntity>(@"SELECT * FROM...
new { offset = pageIndex * pageSize, limi...
var pagedList = new StaticPagedList<MyEntity>...
ViewBag.Rows = pagedList;
return View();
}
}
}
*** View [#g831cf34]
@{
ViewBag.Title = "Index";
}
@using PagedList.Mvc;
@using PagedList;
<link href="~/Content/PagedList.css" rel="stylesheet" />
<h1>@ViewBag.Title</h1>
<ul>
@foreach (var row in ViewBag.Rows)
{
<li>@row.Id @row.Name</li>
}
</ul>
@Html.PagedListPager((IPagedList)ViewBag.rows, page => U...
- https://github.com/troygoode/pagedlist#example-2-manual...
終了行:
* PagedList.MVC [#e6f38f4a]
- https://github.com/TroyGoode/PagedList
- http://www.nuget.org/packages/PagedList.Mvc/
** Manual Paging [#x84f11d5]
*** Controller [#c2bbdb24]
namespace WebApplication1.Controllers
{
public class HomeController : Controller
{
public ActionResult Index(int? page)
{
var pageIndex =( page ?? 1) - 1;
var pageSize = 2;
var dsn = "Server=hv-cent01;Port=5432;User Id...
var cn = new NpgsqlConnection(dsn);
cn.Open();
var count = (int) cn.Query<Int64>(@"SELECT CO...
var rows = cn.Query<MyEntity>(@"SELECT * FROM...
new { offset = pageIndex * pageSize, limi...
var pagedList = new StaticPagedList<MyEntity>...
ViewBag.Rows = pagedList;
return View();
}
}
}
*** View [#g831cf34]
@{
ViewBag.Title = "Index";
}
@using PagedList.Mvc;
@using PagedList;
<link href="~/Content/PagedList.css" rel="stylesheet" />
<h1>@ViewBag.Title</h1>
<ul>
@foreach (var row in ViewBag.Rows)
{
<li>@row.Id @row.Name</li>
}
</ul>
@Html.PagedListPager((IPagedList)ViewBag.rows, page => U...
- https://github.com/troygoode/pagedlist#example-2-manual...
ページ名: