DataBoundControl.PerformSelect 메서드

정의

연결된 데이터 원본에서 데이터를 검색합니다.

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

예제

다음 코드 예제에서는 메서드를 사용 하 여 관련 된 데이터 원본에서 데이터를 검색 하 고 GetData 컨트롤의 요소에 바인딩하는 메서드를 재정 PerformSelect 의 하는 방법을 보여 줍니다. 이 코드 예제는 클래스에 제공된 더 큰 예제의 DataBoundControl 일부입니다.

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

설명

데이터를 PerformDataBinding 데이터 바인딩된 컨트롤의 요소에 바인딩하기 위해 데이터를 검색한 후에 메서드가 호출됩니다. 파생 형식은 기본 구현이 적절하지 않은 경우에만 데이터를 검색하도록 이 메서드를 재정의합니다. 일반적으로 메서드를 DataSourceViewSelectCallback 구현하는 대신 사용자 지정 데이터 작업을 수행하는 대리자를 제공하는 것으로 충분합니다 PerformDataBinding .

적용 대상

추가 정보