DataTable.DefaultView Özellik
Tanım
Filtrelenmiş bir görünüm veya bir imleç konumu içerebilen tablonun özelleştirilmiş bir görünümünü alır.Gets a customized view of the table that may include a filtered view, or a cursor position.
public:
property System::Data::DataView ^ DefaultView { System::Data::DataView ^ get(); };
public System.Data.DataView DefaultView { get; }
[System.ComponentModel.Browsable(false)]
public System.Data.DataView DefaultView { get; }
[System.ComponentModel.Browsable(false)]
[System.Data.DataSysDescription("DataTableDefaultViewDescr")]
public System.Data.DataView DefaultView { get; }
member this.DefaultView : System.Data.DataView
[<System.ComponentModel.Browsable(false)>]
member this.DefaultView : System.Data.DataView
[<System.ComponentModel.Browsable(false)>]
[<System.Data.DataSysDescription("DataTableDefaultViewDescr")>]
member this.DefaultView : System.Data.DataView
Public ReadOnly Property DefaultView As DataView
Özellik Değeri
DataView ile ilişkili DataTable öğesi.The DataView associated with the DataTable.
- Öznitelikler
Örnekler
Aşağıdaki örnek, DataTable özelliği aracılığıyla nesnesinin bir özelliğini ayarlar DataView DefaultView .The following example sets a property of the DataTable object's DataView through the DefaultView property. Örnek ayrıca bir DataGridView denetimin DataTable "COMPANYNAME" adlı bir sütun içeren adlandırılmış bir "Suppliers" öğesine bağlamasını gösterir.The example also shows the binding of a DataGridView control to a DataTable named "Suppliers" that includes a column named "CompanyName."
private void BindDataGrid()
{
DataTable table = new DataTable();
// Insert code to populate a DataTable with data.
// Bind grid to DataTable.
dataGrid1.DataSource = table;
}
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'";
}
Private Sub BindDataGrid()
Dim table As New DataTable
' Insert code to populate a DataTable with data.
' Bind DataGrid to DataTable
DataGrid1.DataSource = table
End Sub
Private Sub ChangeRowFilter()
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
Açıklamalar
DefaultViewÖzelliği, DataView sıralamak, filtrelemek ve aramak için kullanabileceğiniz bir döndürür DataTable .The DefaultView property returns a DataView you can use to sort, filter, and search a DataTable.