Changing DataViewManager.RowFilter has no effect

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

On Feb 12 I posted a request for some help with the subject "Changing the
DataViewManager.RowFilter has no effect". I attached some sample code
written against Northwind demonstrating the problem.

I may not have been logged in with my MSDN Email account so I am reposting
my request under that account in the hopes that someone can take a quick look
and point out the error of my ways.

Thanks
 
Hi Jay,
You don't seem to be getting any replies so I thought I would be it another
try.

If you have a look at the DataViewSettings class in the help, it reads
"Represents the default settings for ApplyDefaultSort, DataViewManager,
RowFilter, RowStateFilter, Sort, and Table for DataViews created from the
DataViewManager".

I think the key word here is DEFAULT.

dataSet.DefaultViewManager.DataViewSettings[ dataTable ].RowFilter =
"Category = 'Cat One'";
DataView dataView = dataSet.DefaultViewManager.CreateDataView(dataTable);
// dataView.RowFilter matches the Category = 'Cat One' from above
dataSet.DefaultViewManager.DataViewSettings[ dataTable ].RowFilter =
"Category = 'Cat Two'";
// dataView.RowFilter isn't updated - it's still Category = 'Cat One'

So it seems DataViewSettings[ dataTable ].RowFilter is only read when
creating a new DataView.

Hope this is of some help.

Best Regards,
Phil.
 
Phil

Thanks for your continued efforts on this one. I don't have my source here
today but I will take a look at it tonight and see if what your saying
applies.

My Dataset and DataViewManager are global objects in this application and I
did notice that if I close and then re-open the form that the
DataViewManager.RowFilter setting is applied.


Phil Williams said:
Hi Jay,
You don't seem to be getting any replies so I thought I would be it another
try.

If you have a look at the DataViewSettings class in the help, it reads
"Represents the default settings for ApplyDefaultSort, DataViewManager,
RowFilter, RowStateFilter, Sort, and Table for DataViews created from the
DataViewManager".

I think the key word here is DEFAULT.

dataSet.DefaultViewManager.DataViewSettings[ dataTable ].RowFilter =
"Category = 'Cat One'";
DataView dataView = dataSet.DefaultViewManager.CreateDataView(dataTable);
// dataView.RowFilter matches the Category = 'Cat One' from above
dataSet.DefaultViewManager.DataViewSettings[ dataTable ].RowFilter =
"Category = 'Cat Two'";
// dataView.RowFilter isn't updated - it's still Category = 'Cat One'

So it seems DataViewSettings[ dataTable ].RowFilter is only read when
creating a new DataView.

Hope this is of some help.

Best Regards,
Phil.

Jay Pondy said:
On Feb 12 I posted a request for some help with the subject "Changing the
DataViewManager.RowFilter has no effect". I attached some sample code
written against Northwind demonstrating the problem.

I may not have been logged in with my MSDN Email account so I am reposting
my request under that account in the hopes that someone can take a quick look
and point out the error of my ways.

Thanks
 
Back
Top