Hi there,
Imagine you want to display a pager below a datagrid in order to allow users
to navigate through data query results returned from database. In 99%
applications results are displayed in paged form, meaning user is presented
with a small chunk of results, i.e. search result returned 1350 records, but
due to several reasons (perfomance, user experience, etc.) your list shows
only 10 records at time. I believe you know all that. DataGrid has got built
in mechanism for paging which is based on entire result set assigned to
datagrid's datasource property. It requires all the records to be included in
paging, which means if you wanted to display only 10 records in 10th page
from your result set (records from 91 to 100) you would have to fetch entire
result set (1350 rows) locally (transfer all the records from database to
local's machine memory). As you can guess it is very inefficient. Therefore,
developers invented much better techniques (custom paging) allowing fetching
required information only . Most of them require page number (or start row
index) and page size (or end row index), but please note to display pager
properly (i.e. show/hide next page button) you have to know how many rows
(pages) are within result set (i.e. query returned 1350 rows, current page =
2, you should show previous and next buttons because you know there are
records before and after as number of matching records is 1350). And here
comes virtualitemcount property which holds total number of rows matching
criteria, which in this case would be 1350. I know it might sound difficult,
but it's easire to understand it on real life example presented by one of
this asp.net community guys Peter Bromber:
http://www.eggheadcafe.com/articles/20060109.asp
Hope this helps