DataBoundControl.PerformSelect Método

Definição

Recupera dados da fonte de dados associada.

protected:
 override void PerformSelect();
protected override void PerformSelect();
override this.PerformSelect : unit -> unit
Protected Overrides Sub PerformSelect ()

Exemplos

O exemplo de código seguinte demonstra como sobrescrever o PerformSelect método para recuperar dados de uma fonte de dados associada usando o GetData método e associá-lo aos elementos do controlo. Este exemplo de código faz parte de um exemplo maior fornecido para a DataBoundControl classe.

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

Observações

O PerformDataBinding método é chamado após a recuperação dos dados para ligar os dados a elementos do controlo data-bound. Tipos derivados sobrepõem-se a este método para recuperar dados apenas se a implementação padrão não for adequada. Normalmente, basta fornecer um DataSourceViewSelectCallback delegado que realize qualquer trabalho personalizado de dados, em vez de implementar o PerformDataBinding método.

Aplica-se a

Ver também