[ Team LiB ] Previous Section Next Section

DataRowView

System.Data (system.data.dll) class

It represents a customized view of a DataRow that is shown in a control when using data binding. For example, if you bind a DataTable to a System.Windows.Forms.DataGrid control, .NET displays the data using the table's default DataView , which contains one DataRowView instance for every DataRow that should be displayed. Unlike a DataRow , the DataRowView can display only one version of the underlying data. This version is determined by the RowVersion property, which is modified automatically during an editing operation to show the proposed value instead of the current value.

You can access the DataRow instance that corresponds to a DataRowView through the Row property. Many DataRowView methods and properties are similar to those of the DataRow . For example, you can programmatically place multiple rows into edit mode using BeginEdit( ) , finish the operation with EndEdit( ) or CancelEdit( ) , or delete a row with Delete( ) . You can also retrieve field values using the column name or the indexer of the DataRowView class. Two read-only properties can be used to determine if a DataRowView is being edited (IsEdit ) or is newly added (IsNew ).

public class DataRowView : System.ComponentModel.ICustomTypeDescriptor, System.ComponentModel.IEditableObject, 
System.ComponentModel.IDataErrorInfo {
// Public Instance Properties
   public DataView DataView{get; } 
   public bool IsEdit{get; } 
   public bool IsNew{get; } 
   public DataRow Row{get; } 
   public DataRowVersion RowVersion{get; } 
   public object this[int ndx]{set; get; } 
   public object this[string property]{set; get; } 
// Public Instance Methods
   public void BeginEdit(  );                              // implements System.ComponentModel.IEditableObject
   public void CancelEdit(  );                             // implements System.ComponentModel.IEditableObject
   public DataView CreateChildView( DataRelation relation);  
   public DataView CreateChildView( string relationName);  
   public void Delete(  );  
   public void EndEdit(  );                                // implements System.ComponentModel.IEditableObject
   public override bool Equals( object other);                 // overrides object
   public override int GetHashCode(  );                          // overrides object
}

Returned By

DataView.{AddNew( ) , FindRows( ) , this}

    [ Team LiB ] Previous Section Next Section