title: Adding an ASP.NET MVC grid to application using PagedList
body: <p>I am trying to add a grid to a table of data in my MVC application but keep getting the following error message:</p>
  
  <pre><code>The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[AssociateTracker.Models.Associate]', but this dictionary requires a model item of type 'PagedList.IPagedList`1[AssociateTracker.Models.Associate]'.
  </code></pre>
  
  <p><strong>View:</strong></p>
  
  <pre><code>@model PagedList.IPagedList&lt;AssociateTracker.Models.Associate&gt;
  
  @{
      ViewBag.Title = "ViewAll";
  }
  
  &lt;h2&gt;View all&lt;/h2&gt;
  
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;First name&lt;/th&gt;
          &lt;th&gt;@Html.ActionLink("Last Name", "ViewAll", new { sortOrder=ViewBag.NameSortParm, currentFilter=ViewBag.CurrentFilter })&lt;/th&gt;
          &lt;th&gt;Email address&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
  @foreach (var item in Model) 
  {
      &lt;tr&gt;
          &lt;td&gt;@item.FirstName&lt;/td&gt;
          &lt;td&gt;@item.LastName&lt;/td&gt;
          &lt;td&gt;@item.Email&lt;/td&gt;
          &lt;td&gt;
              @Html.ActionLink("Details", "Details", new { id = item.AssociateId }) |
              @Html.ActionLink("Edit", "Edit", new { id = item.AssociateId }) |
              @Html.ActionLink("Delete", "Delete", new { id=item.AssociateId })
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  &lt;/table&gt;
  
  &lt;div&gt;
      Page @(Model.PageCount &lt; Model.PageNumber ? 0 : Model.PageNumber)
      of @Model.PageCount
      &amp;nbsp;
      @if (Model.HasPreviousPage)
      {
          @Html.ActionLink("&lt;&lt;", "ViewAll", new { page = 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
          @Html.Raw("&amp;nbsp;");
          @Html.ActionLink("&lt; Prev", "ViewAll", new { page = Model.PageNumber - 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
      }
      else
      {
          @:&lt;&lt;
          @Html.Raw("&amp;nbsp;");
          @:&lt; Prev
      }
      &amp;nbsp;
      @if (Model.HasNextPage)
      {
          @Html.ActionLink("Next &gt;", "ViewAll", new { page = Model.PageNumber + 1, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
          @Html.Raw("&amp;nbsp;");
          @Html.ActionLink("&gt;&gt;", "ViewAll", new { page = Model.PageCount, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter })
      }
      else
      {
          @:Next &gt;
          @Html.Raw("&amp;nbsp;")
          @:&gt;&gt;
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>I have checked against Microsoft's <a href="http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application" rel="nofollow">Contosos University</a> example but can't spot any differences. Can anyone else see what the issue might be?</p>