Hello,
I'm getting an index out of range error on a scroll-to command that doesn't seem to make sense. In the block of code just before the ScrollToRow command, I am setting the datasource equal to null, and then re-initializing the datasource. Next, I am checking if the number of rows exceeds the number that can be displayed, and if so, I wish to scroll to the bottom to display only the last rows. Here is the code:
I run into an error here every time saying that the index is out of range. This is strange to me since in the example, the number of rows is 21 and the rows per page is 14. When the gridview is a windows gridview, the commented out line did the trick just fine.
Any help would be appreciated!
Thanks!
Jeremy
I'm getting an index out of range error on a scroll-to command that doesn't seem to make sense. In the block of code just before the ScrollToRow command, I am setting the datasource equal to null, and then re-initializing the datasource. Next, I am checking if the number of rows exceeds the number that can be displayed, and if so, I wish to scroll to the bottom to display only the last rows. Here is the code:
grdRecords.DataSource = objRecordList; |
AlignRecordGrid(); |
int iVisibleRows = grdRecords.GridElement.RowsPerPage; |
if (grdRecords.Rows.Count > iVisibleRows) |
{ |
grdRecords.GridElement.ScrollToRow(objRecordList.Count - iVisibleRows + 3); |
//grdRecords.FirstDisplayedScrollingRowIndex = objRecordList.Count - iVisibleRows + 3; |
} |
I run into an error here every time saying that the index is out of range. This is strange to me since in the example, the number of rows is 21 and the rows per page is 14. When the gridview is a windows gridview, the commented out line did the trick just fine.
Any help would be appreciated!
Thanks!
Jeremy