This is a migrated thread and some comments may be shown as answers.

pageSize=2147483647 when filterExpression is passed to ObjectDataSource

1 Answer 157 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dar
Top achievements
Rank 1
Dar asked on 22 Oct 2010, 10:04 PM
Hi,
I have the following 2 methods in my ObjectDataSource constucted class

public virtual IList<TEntity> ODSFindAll(int startRow, int pageSize, string sortExpression, string filterExpression) 
  
public virtual int ODSCountAll(string sortExpression, string filterExpression)

Both these methods are called fine by the ObjectDataSource connected to the RadGrid when 'sorting columns' however when filtering the ODSFindAll method is called with pageSize = 2147483647. It shouldn't be as I can see ODSCountAll being called and returning the correct count for the filter.

Without filtering in RadGrid the pageSize value is 10 and RadGrid lets the ODSFindAll method sort the data return just the 10 rows. It calls the ODSCountAll method to find out how many page rows there actually are.

With sorting & filtering  in RadGrid the pageSize value jumps to 2147483647 - which is wasteful and unessesary because I can see it correctly passing both the sortorder and filterexpression correctly. Why is it doing this??


In another posting you suggest setting MaximumRows on the datasource but this causes problems on the 'page summary' where it incorrectly states "500 items in 32 pages" (where 500 is maximumrows and not the count returned by ODSCountAll when filtering.

The other post I refer to is :

 

http://www.telerik.com/community/forums/aspnet/grid/filtering-and-paging-simultaneously-in-objectdatasource.aspx


Regards, Darren

<UPDATE>
I also found this post http://www.telerik.com/community/forums/aspnet-ajax/grid/maximum-rows-parameter-with-filtering.aspx with no clear outcome..


1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 27 Oct 2010, 11:40 AM
Hello Dar,

Indeed, you can receive page size like the mentioned when the grid is trying to perform an operation taht is not supported from the DataSource control itself, like filtering and grouping for instance. In this case you need to provide all the data records to the grid, e.g.:

if(pageSize == int.MaxValue)
{
    //return all records
}


Sincerely yours,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Dar
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or