Bagikan melalui


DataBoundControl.CreateDataSourceSelectArguments Metode

Definisi

Membuat objek default DataSourceSelectArguments yang digunakan oleh kontrol terikat data jika tidak ada argumen yang ditentukan.

protected:
 virtual System::Web::UI::DataSourceSelectArguments ^ CreateDataSourceSelectArguments();
protected virtual System.Web.UI.DataSourceSelectArguments CreateDataSourceSelectArguments();
abstract member CreateDataSourceSelectArguments : unit -> System.Web.UI.DataSourceSelectArguments
override this.CreateDataSourceSelectArguments : unit -> System.Web.UI.DataSourceSelectArguments
Protected Overridable Function CreateDataSourceSelectArguments () As DataSourceSelectArguments

Mengembalikan

Diinisialisasi DataSourceSelectArguments ke Empty.

Contoh

Contoh kode berikut menunjukkan bagaimana CreateDataSourceSelectArguments metode dapat digunakan dalam kelas turunan untuk mengambil objek default DataSourceSelectArguments .

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 CreateDataSourceSelectArguments ini digunakan oleh SelectArguments properti untuk menginisialisasi objek argumen default, dan oleh DataBoundControl implementasi kelas metode PerformSelect .

Berlaku untuk

Lihat juga