J
Juan Romero
Hi guys,
Background:
I have a grid that is bound to a table in a dataset. On first load the
command of the SQLAdapter is configured to get all the records. I also have
a calendar control on the page that changes the SQLAdapter's select command
based on the date range the user selects on the calendar, and rebinds the
datagrid.
When I change the date, the datagrid is refreshed with the new data (new
round trip) and it displays records accordingly. Paging is set to 20 records
per page. I get the value of the recordcount, and it has for example 25
records (2 pages). The link for next page is active since there are 2 pages,
so everything looks fine up to that.
The Problem:
When I click on the "Next page" link of the datagrid, I get the following
error:
"pageindex must be > -1 and < PageCount"
WHY IS THIS HAPPENING?
I mean, the dataset has enough rows for 2 pages, which is why the datagrid
displays the next page link, but when my code tries to set the pageindex
property it gives me this error.
I must also mention that when the grid loads by default the first time with
all the records, the code that changes the pageindex property works fine, no
errors. It is only happening after I change the data to be loaded.
I know I must be missing something, please help. This is a time sensitive
project.
Thanks in advance!
Background:
I have a grid that is bound to a table in a dataset. On first load the
command of the SQLAdapter is configured to get all the records. I also have
a calendar control on the page that changes the SQLAdapter's select command
based on the date range the user selects on the calendar, and rebinds the
datagrid.
When I change the date, the datagrid is refreshed with the new data (new
round trip) and it displays records accordingly. Paging is set to 20 records
per page. I get the value of the recordcount, and it has for example 25
records (2 pages). The link for next page is active since there are 2 pages,
so everything looks fine up to that.
The Problem:
When I click on the "Next page" link of the datagrid, I get the following
error:
"pageindex must be > -1 and < PageCount"
WHY IS THIS HAPPENING?
I mean, the dataset has enough rows for 2 pages, which is why the datagrid
displays the next page link, but when my code tries to set the pageindex
property it gives me this error.
I must also mention that when the grid loads by default the first time with
all the records, the code that changes the pageindex property works fine, no
errors. It is only happening after I change the data to be loaded.
I know I must be missing something, please help. This is a time sensitive
project.
Thanks in advance!