在ASP.net MVC中集成Twitter引导分页
我想用twitter引导在MVC中实现一个分页概念。我已经按照这个url实现了正常的分页,但是如何通过twitter引导实现呢?我对此一无所知 其次,当我删除了太多的页面链接,即一次只能在页面上显示11个链接时,通过遵循上述url,它会给出一个错误,即无法将bool转换为int Index.cshtml在ASP.net MVC中集成Twitter引导分页,asp.net,asp.net-mvc,asp.net-mvc-3,twitter-bootstrap,twitter-bootstrap-3,Asp.net,Asp.net Mvc,Asp.net Mvc 3,Twitter Bootstrap,Twitter Bootstrap 3,我想用twitter引导在MVC中实现一个分页概念。我已经按照这个url实现了正常的分页,但是如何通过twitter引导实现呢?我对此一无所知 其次,当我删除了太多的页面链接,即一次只能在页面上显示11个链接时,通过遵循上述url,它会给出一个错误,即无法将bool转换为int Index.cshtml @model IEnumerable<MvcPagingConcept.Models.tbl_product> @{ Layout = null; } <t
@model IEnumerable<MvcPagingConcept.Models.tbl_product>
@{
Layout = null;
}
<table>
<thead>
<tr>
<td> Product Name </td>
<td> Product Description</td>
</tr>
</thead>
@{int i = 1;}
@foreach (var p in Model)
{
<tr class="@(i++ % 2 == 0 ? "highlighted" : "")">
<td>@p.ProductName
</td>
<td>@p.ProductDesc
</td>
</tr>
}
</table>
<div class="pagination">
@for (int p = 1; p <= ViewBag.TotalPages; p++)
{
<a class="@(p == ViewBag.CurrentPage ? "current" : "")" href="@Url.Action("Index", "Home", new { page = p })">@p</a>
}
</div>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcPagingConcept.Models;
namespace MvcPagingConcept.Controllers
{
public class HomeController : Controller
{
ProductEntities prdEntity = new ProductEntities();
const int pageSize = 3;
[HttpGet]
public ActionResult Index(int page = 1)
{
var products = prdEntity.tbl_product.OrderBy(p => p.ProductId).Skip((page - 1) * pageSize).Take(pageSize).ToList();
ViewBag.CurrentPage = page;
ViewBag.PageSize = pageSize;
ViewBag.TotalPages=Math.Ceiling((double)prdEntity.tbl_product.Count() / pageSize);
return View(products);
}
}
}