I got a trouble in my asp.net proyect. I want to paginate my table but i'm unable to launch my site.
That's the problem:
- I created entity model into 'Context' folder with getters and setters of my table
- Then i generated the controller with vs
I modify controller with this code
public ActionResult Index(int? page) { var firmas = from f in db.Firmas select f; if (Request.HttpMethod != "GET") { page = 1; } int pageSize = 2; int pageNumber = (page ?? 1); return View(firmas.ToPagedList(pageSize, pageNumber)); }
And i got this into cshtml index
@*@model IEnumerable<actiTest2.Context.Firmas>*@
@model PagedList.IPagedList<actiTest2.Controllers.FirmasController>
@using PagedList;
@using PagedList.Mvc;
That's the point, if i call model IEnumerable, program crash cause need IPagedList, but if i call IPagedList program say that 'FirmasController' does not contain a definition for my model display.
What could i do? Merge Controller and auto-generated code with get/set errs?
Thanks in advance
EDIT: After apply the 'smoksnes' solution i got a new problem: