DefaultViewManager

J

jt

In MSDN library, it says that when data binding if you
bind to a DataTable, in fact you bind to its DefaultView,
and if you bind to a DataSet, in fact you bind to its
DefaultViewManager.

It is true for DataTable. If I use the following binding:

dataGrid1.DataSource = dataSet1.Employee;
dataGrid1.DataMember = null;

Everytime I change the filter, the DataGrid changes, too.

dataSet1.Employee.DefaultView.RowFilter = "Name < 'H'";

However, if I use the following binding:

dataGrid1.DataSource = dataSet1;
dataGrid1.DataMember = "Employee";

When I change the filter, the DataGrid is not responding.

dataSet1.DefaultViewManager.DataViewSettings
["Employee"].RowFilter = "Name < 'H'";

I saw some programmers work around the problem by
constructing a new DataViewManager. I wonder why Microsoft
doesn't admit there is a bug, or say this behavior is by
design.

JT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top