C
carlor
Hi there,
I'm at a loss to resolve this so I'm hoping someone can enlighten me.
I have a search user control that contains and displays a results user
control if files are found. If any results are found, I set the results UC
datatable property to the results datatable, set the results datagrid's
datasource to the dataTable and perform a dataBind. That works fine.
I am using paging on the dataGrid and that works. The problem I'm running
into is when I perform another find after changing pages on the dataGrid.
Let's say my first result set produced 5 pages of results and I select and
display the 3rd page. I then perform another find which produces a result set
of only 1 page. The results UC is still there so I set the UC's dataTable
property to the new results set, set the dataGrid's dataSource to the new
dataTable (because this is a postback the dataSource is nothing) and perform
a dataBind.
This is where it blows up. Because the dataGrid's CurrentPageIndex is set to
the 3rd page but the new result set only has 1 page, I get the following
exception:
"Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount."
Am I missing something painfully obvious? Any idea how I resolve this problem?
Thanks a bunch,
Carlo.
I'm at a loss to resolve this so I'm hoping someone can enlighten me.
I have a search user control that contains and displays a results user
control if files are found. If any results are found, I set the results UC
datatable property to the results datatable, set the results datagrid's
datasource to the dataTable and perform a dataBind. That works fine.
I am using paging on the dataGrid and that works. The problem I'm running
into is when I perform another find after changing pages on the dataGrid.
Let's say my first result set produced 5 pages of results and I select and
display the 3rd page. I then perform another find which produces a result set
of only 1 page. The results UC is still there so I set the UC's dataTable
property to the new results set, set the dataGrid's dataSource to the new
dataTable (because this is a postback the dataSource is nothing) and perform
a dataBind.
This is where it blows up. Because the dataGrid's CurrentPageIndex is set to
the 3rd page but the new result set only has 1 page, I get the following
exception:
"Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount."
Am I missing something painfully obvious? Any idea how I resolve this problem?
Thanks a bunch,
Carlo.