M
Mark Rae
Hi,
I have an <aspataGrid> control to which I'm trying to bind an
SqlDataReader. When I do so, I get the following error:
AllowCustomPaging must be true and VirtualItemCount must be set for a
DataGrid with ID dgrdTimesheet when AllowPaging is set to true and the
selected datasource does not implement ICollection.
If I set the datagrid's AllowCustomPaging property to true and its
VirtualItemCount property to be the number of records returned by the
SqlDataReader, the error disappears. The datagrid's paging hyperlinks
correctly show the correct number of pages, but each page contains the first
page's data. I.e.
SqlDataReader contains 76 rows
DataGrid's page size is 10 rows
DataGrid correctly shows pages 1-8
Clicking on page 1 correctly shows the first 10 records
Clicking on any other page incorrectly shows the first 10 records, not
11-20, 21-30 etc.
Of course, using a DataSet object instead of an SqlDataReader object cures
the problem instantly, but I was wondering if there is any way to use an
SqlDataReader object as the datasource of a datagrid which supports paging?
Any assistance gratefully received.
Mark
I have an <aspataGrid> control to which I'm trying to bind an
SqlDataReader. When I do so, I get the following error:
AllowCustomPaging must be true and VirtualItemCount must be set for a
DataGrid with ID dgrdTimesheet when AllowPaging is set to true and the
selected datasource does not implement ICollection.
If I set the datagrid's AllowCustomPaging property to true and its
VirtualItemCount property to be the number of records returned by the
SqlDataReader, the error disappears. The datagrid's paging hyperlinks
correctly show the correct number of pages, but each page contains the first
page's data. I.e.
SqlDataReader contains 76 rows
DataGrid's page size is 10 rows
DataGrid correctly shows pages 1-8
Clicking on page 1 correctly shows the first 10 records
Clicking on any other page incorrectly shows the first 10 records, not
11-20, 21-30 etc.
Of course, using a DataSet object instead of an SqlDataReader object cures
the problem instantly, but I was wondering if there is any way to use an
SqlDataReader object as the datasource of a datagrid which supports paging?
Any assistance gratefully received.
Mark