PagedList MVC does not contain a definition for PagedListPager
PageCount
, PageNumber
etc are properties of IPagedList<T>
, not IEnumerable<T>
. You need to change the model in the view to use IPagedList<T>
, and include the relevant using statements.
@using PagedList; // add
@using PagedList.Mvc; //add
@model IPagedList<RecreationalServicesTicketingSystem.Models.User> // change
@{
ViewBag.Title = "Users";
}
.....
You missing using of PagedList and PagedList.Mvc , as others told you.
What I can add, better add using of namespaces in file Views/Web.Config instead. This will allow you to use namespaces PagedList and PagedList.Mvc in all Views, and shorten your code. Example:
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
<add namespace="PagedList" /> <!--Add this line-->
<add namespace="PagedList.MVC" /> <!--Add this line-->
</namespaces>
</pages>
</system.web.webPages.razor>
And no more need to use using in everyone view/cshtml
@* @using PagedList; // No more need of this, can delete this line *@
@* @using PagedList.Mvc; // No more need of this, can delete this line *@
@model IPagedList<RecreationalServicesTicketingSystem.Models.User> // change
@{
ViewBag.Title = "Users";
}
.....
This is especially valuable, when you have a big project, it will shorten your code.