MVC 4 pagination

Here is the extract of my code and the error which I am facing. Can anyone please help me.

var rentList = from s in db.TANK_LEASE_DETAILs
               join tm in db.TANK_MASTERs on s.TANK_MASTER_ID equals tm.TANK_ID
               select new { s,tm };

tanks = rentList.ToPagedList(currentPageIndex, defaultPageSize);

Error 1 Cannot implicitly convert type 'MvcPaging.IPagedList' to 'System.Collections.Generic.IList'. An explicit conversion exists (are you missing a cast?)

Upvotes: 0

Views: 65

Answers (1)

Alan Tsai
Alan Tsai

Reputation: 2525

what is the type of your tanks variable? as error message imply, it is IList not IPagedList.

you should change the type of tanks to IPagedList, or use var:

var tanks = rentList.ToPagedList(currentPageIndex, defaultPageSize);

Upvotes: 1

Related Questions