asp.net.ph

DataView Class

System.Data Namespace


Represents a databindable, customized view of a DataTable for sorting, filtering, searching, editing, and navigation.

DataView Class Members

Collapse   Constructors

Visibility Constructor Parameters
public DataView ( )
public DataView ( DataTable table )
public DataView ( DataTable table , String RowFilter , String Sort , DataViewRowState RowState )

Collapse   Properties

Visibility Name Value Type Accessibility
public AllowDelete Boolean [ Get , Set ]
public AllowEdit Boolean [ Get , Set ]
public AllowNew Boolean [ Get , Set ]
public ApplyDefaultSort Boolean [ Get , Set ]
public Count Int32 [ Get ]
public DataViewManager DataViewManager [ Get ]
public IsInitialized Boolean [ Get ]
public Item ( Int32 recordIndex ) DataRowView [ Get ]
public RowFilter String [ Get , Set ]
public RowStateFilter DataViewRowState [ Get , Set ]
public Sort String [ Get , Set ]
public Table DataTable [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
public AddNew ( ) DataRowView
public BeginInit ( ) Void
protected Close ( ) Void
protected ColumnCollectionChanged ( Object sender , CollectionChangeEventArgs e ) Void
public CopyTo ( Array array , Int32 index ) Void
public Delete ( Int32 index ) Void
protected Dispose ( Boolean disposing ) Void
public EndInit ( ) Void
public Equals ( DataView view ) Boolean
public Find ( Object key ) Int32
public Find ( Object key ) Int32
public FindRows ( Object key ) DataRowView
public FindRows ( Object key ) DataRowView
public GetEnumerator ( ) IEnumerator
protected IndexListChanged ( Object sender , ListChangedEventArgs e ) Void
protected OnListChanged ( ListChangedEventArgs e ) Void
protected Open ( ) Void
protected Reset ( ) Void
public ToTable ( Boolean distinct , String columnNames ) DataTable
public ToTable ( String tableName , Boolean distinct , String columnNames ) DataTable
public ToTable ( String tableName ) DataTable
public ToTable ( ) DataTable
protected UpdateIndex ( ) Void
protected UpdateIndex ( Boolean force ) Void

Collapse   Events

Multicast Name Type
multicast Initialized EventHandler
multicast ListChanged ListChangedEventHandler

Remarks

A major function of the DataView is to allow data binding on both Windows Forms and Web Forms.

Additionally, a DataView can be customized to present a subset of data from the DataTable. This capability allows you to have two controls bound to the same DataTable, but showing different versions of the data. For example, one control may be bound to a DataView showing all of the rows in the table, while a second may be configured to display only the rows that have been deleted from the DataTable. The DataTable also has a DefaultView property which returns the default DataView for the table. For example, if you wish to create a custom view on the table, set the RowFilter on the DataView returned by the DefaultView.

To create a filtered and sorted view of data, set the RowFilter and Sort properties. Then use the Item property ( DataView indexer ) to return a single DataRowView.

You can also add and delete from the set of rows using the AddNew and Delete methods. When you use those methods, the RowStateFilter property can set to specify that only deleted rows or new rows be displayed by the DataView.

See Also

DataSet   DataTable   DataViewManager Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph