Sunday, August 26, 2007

DataView Object

DATAVIEW OBJECT

  • The DataView class represents a customized view of DataTable
  • The relationship between DataTable and DataView are governed by the rules of a well-known design pattern; the document/view model
  • The DataTable ojects act as the document, whereas the DataView behaves as the view
  • At any moment there can be multiple views for the same underlying data
  • The view is implemented by maintaining a separate array with the indexes of the original rows that match the criteria set on the view
  • By default, the table view is unfiltered and contains all the records included in the table
  • A DataView does not contain copies of the table's rows. It is limited to storing an array of indexes that is updated whenever any of the filter properties are set


 

IMPORTANT PROPERTIES OF DATAVIEW CLASS

AllowDelete / AllowEdit / AllowNew

Get or set permissions to allow row operations in view

ApplyDefaultSort

Permission to allow default sorting

RowFilter

G/sets the expression used to filter out rows in the view

Sort

G/sets the sorting of the view in terms of columns and order

Table

G/sets the source DataTable for the view

DataViewManager

Gets the DataViewManager object associated with this view


 

IMPORTANT METHODS OF DATAVIEW CLASS

AddNew

Add a new row to the view and the underlying table

BeginInit / EndInit

Begin / End initialization of the view, used for multiple changes

Delete

Delete the row at specified index, deletes row in table too

Find

Finds a row using specified key value

FindRows

Returns an array of row objects that match specified key value

GetEnumerator

Returns an enumerator object for the DataView


 

No comments: