DataTable.defaultView attribute

xiaoxiao2021-03-06  21

.NET Framework class library

DataTable.defaultView attribute

Get a custom view that may include a table of screening views or cursor locations.

[Visual Basic]

Public Readonly Property DefaultView As DataView

[C #]

Public DataView DefaultView {Get;

[C ]

Public: __property dataview * get_defaultView ();

[Jscript]

PUBLIC FUNCTION GET DEFAULTVIEW (): DataView;

Attribute value

DataView associated with DataTable.

Note

The DEFAULTVIEW attribute returns a DataView that can be sorted, filtered, and searched for DataTable.

Example

[Visual Basic, C #, C ] The following example sets the properties of the DataTable object through the DEFAULTVIEW property. This example also shows the DataGrid control with DataTable named "Suppliers", and DataTable includes columns named "CompanyName".

[Visual Basic]

Private sub binddatagrid ()

DIM MyDataTable As New DataTable

'INSERT Code to Populate a DataTable with data.

'Bind DataGrid to DataTable

DataGrid1.datasource = MyDATABLE

End Sub

Private sub channelerowfilter ()

DIM Gridtable as datatable = ctype (DataGrid1.datasource, DataTable)

'Set The Rowfilter to Display a Company Names That Begin with a through I.

Gridtable.defaultview.rowfilter = "CompanyName <'I'"

End Sub

[C #]

Private void binddatagrid () {

DataTable myDataTable = new dataatable ();

// INSERT CODE TO POPLATE A DATATABLE with DATA.

// Bind Grid to DataTable.

DataGrid1.datasource = MyDataTable;

}

Private void ChanGerowFilter () {

DataTable Gridtable = (DataTable) DataGrid1.datasource;

// set The Rowfilter to Display a Company Names That Begin with a Through I ..

Gridtable.defaultview.rowfilter = "CompanyName <'I'";

}

[C ]

Private:

Void binddatagrid () {

DataTable * mydataable = new data ();

// INSERT CODE TO POPLATE A DATATABLE with DATA.

// Bind Grid to DataTable.

DataGrid1-> DataSource = mydataable;

}

Void ChanGerowFilter () {dataable * Gridtable = Dynamic_cast (dataGrid1-> datasource);

// set The Rowfilter to Display a Company Names That Begin with a Through I ..

Gridtable-> defaultview-> rowfilter = s "CompanyName <'I'"

}

[JScript] There is no example available for JScript. To view Visual Basic, C # or C examples, click the "Language Filter" button in the upper left corner.

Claim

Platform: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 Series, .NET Framework Lite

See

DataTable class | DataTable member | system.data namespace

转载请注明原文地址:https://www.9cbs.com/read-42845.html

New Post(0)