views:

69

answers:

2

I have a data table that is being filled by a stored procedure. I need to filter down the results some, so I get a data view from the default view and apply a row filter to it. I then bind this to my DataGrid. All is fine at this point. I see two pages (17 records with 10 per page). If i apply a sort to the grid though, it now shows 5 pages (58 records without the filter). I stepped through the code and it repopulates the data prior to running the sort. The repopulation is with with the filter in place and it counts 17 records, but shows 5 pages.

To make it even weirder, if I click on a page i know will be invalid, it runs the page change (which also repopulates the data) and this time it limits the pages to 2 and tells me i have an invalid page number!

Any ideas?

A: 

Make sure to apply the sort to the default view and not the grid column directly.

Matt Wrock
I did. I think it could be related to a custom version of the DataGrid we have internally. we have something called a AutoDataSet and the sort runs off it. It uses the dataset my dataview is created from.
Rob
A: 

It was the custom control causing the problem. We have an AutoDataSource function that automatically pulls the data tables out of my view and sorts on them. I found a filter function in my grid that apply the filter, but only if applied before setting the datasource

Rob