DataBoundControl.CreateDataSourceSelectArguments 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
如果沒有指定引數,則會建立資料繫結控制項使用的預設 DataSourceSelectArguments 物件。
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
傳回
初始化為 DataSourceSelectArguments 的 Empty。
範例
下列程式碼範例示範如何在 CreateDataSourceSelectArguments 衍生類別中使用 方法來擷取預設 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
備註
屬性 CreateDataSourceSelectArguments 會使用 SelectArguments 方法初始化預設引數物件,以及 DataBoundControl 類別的 PerformSelect 方法實作。