title: PagedList MVC does not contain a definition for PagedListPager
body: <p>I don't know why PageCount,PageNumber and PageListPager doesn't contain a definintion or could not be found. It's asking if I'm missing a using directive or an assembly reference but I have it in my user controller.</p>
  
  <pre><code>Page @(Model.PageCount &lt; Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
   to 
  @Html.PagedListPager( Model, page =&gt; Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter }) )
  </code></pre>
  
  <p>Note: IMAGES AND CODE BELOW ARE ONLY FOR REFERENCE</p>
  
  <p><a href="https://i.stack.imgur.com/9A4Pz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9A4Pz.png" alt="Database Error"></a></p>
  
  <p><a href="https://i.stack.imgur.com/X6DKL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/X6DKL.png" alt="Visual Studio error"></a></p>
  
  <p>Controllers\UserController.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data;
  using System.Data.Entity;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  using RecreationalServicesTicketingSystem.Models;
  using RecreationalServicesTicketingSystem.DAL;
  using PagedList;
  
  namespace RecreationalServicesTicketingSystem.Controllers
  {
      public class UserController : Controller
      {
          private IssueContext db = new IssueContext();
  
          //
          // GET: /User/
  
          public ViewResult Index(string sortOrder, string currentFilter, string searchString, int? page)
          {
              ViewBag.CurrentSort = sortOrder;
              ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
              ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date";
  
              if (searchString != null)
              {
                  page = 1;
              }
              else
              {
                  searchString = currentFilter;
              }
  
              ViewBag.CurrentFilter = searchString;
  
              var users = from s in db.Users
                             select s;
              if (!String.IsNullOrEmpty(searchString))
              {
                  users = users.Where(s =&gt; s.LastName.ToUpper().Contains(searchString.ToUpper())
                                         || s.FirstMidName.ToUpper().Contains(searchString.ToUpper()));
              }
              switch (sortOrder)
              {
                  case "name_desc":
                      users = users.OrderByDescending(s =&gt; s.LastName);
                      break;
                  case "Date":
                      users = users.OrderBy(s =&gt; s.EnrollmentDate);
                      break;
                  case "date_desc":
                      users = users.OrderByDescending(s =&gt; s.EnrollmentDate);
                      break;
                  default:  // Name ascending 
                      users = users.OrderBy(s =&gt; s.LastName);
                      break;
              }
  
              int pageSize = 3;
              int pageNumber = (page ?? 1);
              return View(users.ToPagedList(pageNumber, pageSize));
          }
  </code></pre>
  
  <p>Views\User\Index.cshtml</p>
  
  <pre><code>@model IEnumerable&lt;RecreationalServicesTicketingSystem.Models.User&gt;
  
  @{
      ViewBag.Title = "Users";
  }
  
  &lt;h2&gt;Users&lt;/h2&gt;
  
  &lt;p&gt;
      @Html.ActionLink("Create New", "Create")
  &lt;/p&gt;
  @using (Html.BeginForm("Index", "User", FormMethod.Get))
  {
      &lt;p&gt;
          Find by name: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string)  
          &lt;input type="submit" value="Search" /&gt;
      &lt;/p&gt;
  }
  
  &lt;table&gt;
       &lt;tr&gt;
          &lt;th&gt;
   @Html.ActionLink("Last Name", "Index", new { sortOrder=ViewBag.NameSortParm, currentFilter=ViewBag.CurrentFilter })
          &lt;/th&gt;
          &lt;th&gt;First Name
          &lt;/th&gt;
          &lt;th&gt;
              @Html.ActionLink("Enrollment Date", "Index", new { sortOrder = ViewBag.DateSortParm })
          &lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
  @foreach (var item in Model) {
      &lt;tr&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.LastName)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.FirstMidName)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.EnrollmentDate)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.ActionLink("Edit", "Edit", new { id=item.UserID }) |
              @Html.ActionLink("Details", "Details", new { id=item.UserID }) |
              @Html.ActionLink("Delete", "Delete", new { id=item.UserID })
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  
  &lt;/table&gt;
  &lt;br /&gt;
  Page @(Model.PageCount &lt; Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
   to 
  @Html.PagedListPager( Model, page =&gt; Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter }) )
  </code></pre>