The DataViewManager is used when binding an entire DataSet to a control. When binding a DataSet to a control, you have two choices. You can explicitly create a DataViewManager object and bind that, or you can bind to the DataSet that contains the data. In the latter case, ADO.NET automatically uses the default DataViewManager accessed using the DataSet.DefaultViewManager property.

Understanding this process becomes important if you want to control the display of data (for example, applying a sort of filter expression). When binding an entire DataSet, ADO.NET doesn’t use the default DataView objects that are associated with each table and accessed using the DataTable.DefaultView property. Instead, it uses the DataViewSetting. The default DataViewManager for a DataSet contains one DataViewSetting for each DataTable. You can access this collection and modify individual DataViewSetting objects through the DataViewSettings property.

public class DataViewManager : System.ComponentModel.MarshalByValueComponent, 

System.ComponentModel.IBindingList, IList, ICollection, IEnumerable, 

System.ComponentModel.ITypedList {

// Public Constructors

   public DataViewManager( );  

   public DataViewManager(DataSet dataSet);  

// Public Instance Properties

   public DataSet DataSet{set; get; } 

   public string DataViewSettingCollectionString{set; get; } 

   public DataViewSettingCollection DataViewSettings{get; } 

// Public Instance Methods

   public DataView CreateDataView(DataTable table);  

// Protected ...

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.