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
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