DataBoundControl.CreateDataSourceSelectArguments 方法

定义

如果未指定参数,则创建由数据绑定控件使用的默认 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

返回

初始化为 DataSourceSelectArgumentsEmpty

示例

下面的代码示例演示如何 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

适用于

另请参阅