On all the custom paging examples that I have seen VirtualItemCount is set to some big number and not the actual number of rows in the data source.
There are two problems with it. First, this number is misleading as grid shows "item 1 of 10000". This can be relatively easy solved by running another query against dataset, something like "select count(*) from ...", but here comes second problem.
When grid has filters the VirtualItemCount should be smaller, that is the dataset should be additionally filtered with current filter expression. On the surface, this seems not hard to do as well - change EnableLinqExpressions to 'false', grab FilterExpression propery and use the value as additional WHERE clause. The issue is that FilterExpression propery is not always set. It appears that it is not set during NeedDataSource event.
I wonder if Telerik has a complete custom paging example that works correcly with filters.
-Stan
There are two problems with it. First, this number is misleading as grid shows "item 1 of 10000". This can be relatively easy solved by running another query against dataset, something like "select count(*) from ...", but here comes second problem.
When grid has filters the VirtualItemCount should be smaller, that is the dataset should be additionally filtered with current filter expression. On the surface, this seems not hard to do as well - change EnableLinqExpressions to 'false', grab FilterExpression propery and use the value as additional WHERE clause. The issue is that FilterExpression propery is not always set. It appears that it is not set during NeedDataSource event.
I wonder if Telerik has a complete custom paging example that works correcly with filters.
-Stan