Does anyone know how paging works with controls such as listview.
I currently page results using my own sql. I write my queries so it only returns the exact amount of records to fill the paginated page to a dataset, which then populates the control.
I guess the question im asking is when using a control such as a list view does it return the whole dataset to memory and then page through the records from memory or does it return only a selection of data to memory as specified by the page number selected.
How many records listview will fetch and show, completely depends on your implementation. If your query is returning all records, it will take them all and show the ones which are needed. If your queries are returning,
1) total number of records
2) And only selected records
then it will show only selected records. In short, listview is okay with anything and leaves the code efficiency on you.
A quick search on internet returned following article which is implementing efficient pagination using objectdatasource, row_number and pager :
http://gugiaji.wordpress.com/2012/02/17/custom-paging-using-objectdatasource-listview-datapager-asp-net-controls-and-row_number-sql-server-function/