title: Custom server paging in asp.net with listview and datapager control
body: <p>I have a listview control in a page and i want to do a custom server paging for the listview data. So instead of getting whole data and keeping in the memory, I would like to bring data in chunks and then bind the listview control.</p>
  
  <p>For example: </p>
  
  <p>If I request </p>
  
  <p><a href="http://www.mywebsite.com/getlistofdata.aspx?p=1" rel="nofollow">http://www.mywebsite.com/getlistofdata.aspx?p=1</a>, the first page come with 10 items
  <a href="http://www.mywebsite.com/getlistofdata.aspx?p=2" rel="nofollow">http://www.mywebsite.com/getlistofdata.aspx?p=2</a>, the second page comes up with another 10 items
  and likewise.</p>
  
  <p>I have written a function <strong>BindListView(int pageNumber, int pageSize, out int totalRowsCount)</strong>
  that returns me the data according to the page number and page size passed.</p>
  
  <p>How can I make the Datapager work in this situation?</p>
  
  <p>The problem is it shows one link to navigate for only one page, i need to populate the datapager according to the value of <strong>totalRowsCount</strong>.</p>