title: mvc pagedlist asp.net membership
body: <p>I am using the PagedList.mvc helper with ASP.NET membership to display application user details in a table. The pager works correctly using the Membership.GetAllUsers() method, but I would like to be able to take advantage of the overload that returns a single page of data, rather than the whole table, as suggested in <a href="https://stackoverflow.com/questions/1214162/working-with-pagedlist-and-membership">this article</a>:</p>
  
  <pre><code>        int pageSize = int.Parse(ConfigurationManager.AppSettings["gridPageSize"]);
          int totalRecords;
          IEnumerable&lt;MembershipUser&gt; users = Membership.GetAllUsers((page ?? 0), pageSize, out totalRecords).Cast&lt;MembershipUser&gt;();
          return View(users.ToPagedList((page ?? 1), pageSize));
  </code></pre>
  
  <p>The above code, which uses the overload in question, unfortunately only displays the first page of data, and provides no link to the second or subsequent pages. It seems this is because the PagedList helper configures itself according to the size of the collection passed to it, rather than the actual size of the table (available from the output parameter of GetAllUsers(int, out int). </p>
  
  <p>Does anyone know of a way round this apparent limitation?</p>