title: Manually setting a GridView's PageCount when DataSource doesn't return full result set?
body: <p>I'm trying to figure out ASP.NET's <code>GridView</code> pagination mechanics so I can use the framework's native functionality instead of my company's home-brewed manual pagination routines which take a lot of work to implement.</p>
  
  <p>I've figured out everything except how get the <code>GridView</code>'s PageCount property to work with our web services. Currently, our web services return the total record count like the following:</p>
  
  <pre><code>public object[] GetStuffMethod(int pageNum, int recordsPerPage, out int totalRecords)
  </code></pre>
  
  <p>This works fine with a GridView, however the documentation I've found says that the <code>GrideView</code>'s <code>PageCount</code> property is generated from the total records in the DataSource. Is there really no way to set the PageCount based on something else other than returning all of the records?</p>
  
  <p>There could be tens of thousands of records in my data source so I'd rather not select all of them just to make the GridView's page count work. I probably could just ignore the GridView's page count and calculate it on my own, but if the framework has a way to do this, I'd rather use it.</p>