DataBoundControl.CreateDataSourceSelectArguments Metod

Definition

Skapar ett standardobjekt DataSourceSelectArguments som används av den databundna kontrollen om inga argument anges.

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

Returer

En DataSourceSelectArguments initierad till Empty.

Exempel

Följande kodexempel visar hur CreateDataSourceSelectArguments metoden kan användas i en härledd klass för att hämta ett standardobjekt 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

Kommentarer

Metoden CreateDataSourceSelectArguments används av SelectArguments egenskapen för att initiera ett standardargumentobjekt och av DataBoundControl klassens implementering av PerformSelect metoden.

Gäller för

Se även