DataBoundControl.PerformSelect Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mengambil data dari sumber data terkait.
protected:
override void PerformSelect();
protected override void PerformSelect();
override this.PerformSelect : unit -> unit
Protected Overrides Sub PerformSelect ()
Contoh
Contoh kode berikut menunjukkan cara mengambil alih PerformSelect metode untuk mengambil data dari sumber data terkait menggunakan GetData metode dan mengikatnya ke elemen kontrol. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk DataBoundControl kelas .
protected override void PerformSelect() {
// Call OnDataBinding here if bound to a data source using the
// DataSource property (instead of a DataSourceID), because the
// databinding statement is evaluated before the call to GetData.
if (!IsBoundUsingDataSourceID) {
OnDataBinding(EventArgs.Empty);
}
// The GetData method retrieves the DataSourceView object from
// the IDataSource associated with the data-bound control.
GetData().Select(CreateDataSourceSelectArguments(),
OnDataSourceViewSelectCallback);
// The PerformDataBinding method has completed.
RequiresDataBinding = false;
MarkAsDataBound();
// Raise the DataBound event.
OnDataBound(EventArgs.Empty);
}
Protected Overrides Sub PerformSelect()
' Call OnDataBinding here if bound to a data source using the
' DataSource property (instead of a DataSourceID) because the
' data-binding statement is evaluated before the call to GetData.
If Not IsBoundUsingDataSourceID Then
OnDataBinding(EventArgs.Empty)
End If
' The GetData method retrieves the DataSourceView object from the
' IDataSource associated with the data-bound control.
GetData().Select(CreateDataSourceSelectArguments(), _
AddressOf OnDataSourceViewSelectCallback)
' The PerformDataBinding method has completed.
RequiresDataBinding = False
MarkAsDataBound()
' Raise the DataBound event.
OnDataBound(EventArgs.Empty)
End Sub
Keterangan
Metode PerformDataBinding ini dipanggil setelah data diambil untuk mengikat data ke elemen kontrol terikat data. Jenis turunan mengambil alih metode ini untuk mengambil data hanya jika implementasi default tidak memadai. Biasanya, cukup untuk menyediakan DataSourceViewSelectCallback delegasi yang melakukan pekerjaan data kustom apa pun, daripada menerapkan PerformDataBinding metode .