Name

DataRowView

Synopsis

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

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.