Iam using the radgrid, in my web application. Iwant to avoid the refetch of records when paging button is clicked on the radgrid. I have a method SetTodaysAlerts which gets near about 100 records and binds to my radgrid. The page size of the radgrid is 10, hence First, Next, Previous and Last buttons are available. When I click the next button how can I avoid the re fetching of the records again. FYI: Iam using the radgrid_NeedDataSource event which does the datafetch again when any navigatin button is clicked on the radgrid.
views:
43answers:
1
A:
Basically you need to have one function that counts the total number of records for the query and another that selects only those that fall within the current page.
When using a RadGrid (assuming AllowCustomPaging = true) you need to first count the total number of records and save the value in the property VirtualItemCount of the RadGrid.
Now in the NeedDataSource which is called on the change of a page you need to calculate the range of records to retrieve as follows :
int firstRow = radGrid.CurrentPageIndex * radGrid.PageSize;
int maxRow = radGrid.PageSize;
and then pass them into your query, get the results, do a set DataSource and a Rebind()
Tom Carter
2010-04-07 09:59:18