Che cosa potrebbe causare questo problema?Il metodo 'Salta' è supportato solo per l'input ordinato in LINQ alle entità
public ActionResult Index(int page = 0)
{
const int pageSize = 3;
var areas = repo.FindAllAreas();
var paginatedArea = new PaginatedList<Area>(areas, page, pageSize);
return View(paginatedArea);
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UTEPSA.Controllers
{
class PaginatedList<T> : List<T>
{
public int PageIndex { get; private set; }
public int PageSize { get; private set; }
public int TotalCount { get; private set; }
public int TotalPages { get; private set; }
public PaginatedList(IQueryable<T> source, int pageIndex, int pageSize)
{
PageIndex = pageIndex;
PageSize = pageSize;
TotalCount = source.Count();
TotalPages = (int)Math.Ceiling(TotalCount/(double)PageSize);
//ERROR HERE->>this.AddRange(source.Skip(PageIndex * PageSize).Take(PageSize));
}
public bool HasPreviousPage
{
get
{
return (PageIndex > 0);
}
}
public bool HasNextPage
{
get
{
return (PageIndex + 1 < TotalPages);
}
}
}
}
Qualche suggerimento?
Hai guardato la libreria mvccontrib? Contiene un componente cercapersone: http://www.jeremyskinner.co.uk/2010/03/14/mvccontrib-grid-part-6-sorting/. Non sono sicuro di come si avvicini a questo problema ... – jeroenh