BaseDataBoundControl.OnDataBound(EventArgs) 메서드

정의

DataBound 이벤트를 발생시킵니다.

protected:
 virtual void OnDataBound(EventArgs ^ e);
protected virtual void OnDataBound (EventArgs e);
abstract member OnDataBound : EventArgs -> unit
override this.OnDataBound : EventArgs -> unit
Protected Overridable Sub OnDataBound (e As EventArgs)

매개 변수

e
EventArgs

이벤트 데이터가 포함된 EventArgs 개체입니다.

예제

다음 코드 예제에서는 하는 방법을 OnDataBound 메서드는 발생 시키는 데는 DataBound 데이터 바인딩된 컨트롤을 파생된 클래스에서 이벤트입니다. 사용한 후는 GetDataPerformDataBinding 컨트롤을 데이터 바인딩된 컨트롤에 데이터를 바인딩할 메서드를 DataBound 완료 되는 데이터 바인딩 신호를 보내는 이벤트. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 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

설명

이 메서드는 컨트롤과 연결 된 모든 데이터 바인딩 논리가 완료 하는 서버 컨트롤을 알립니다.

중요

합니다 DataBind 에서 파생 된 모든 컨트롤에 메서드가 봉인 되었습니다. BaseDataBoundControl합니다. 데이터 바인딩된 컨트롤 재정의 해야 PerformDataBinding 대신는 DataBind 데이터 바인딩 방법입니다. 경우 DataBind 를 재정의 합니다 OnDataBindingOnDataBound 순서가 이벤트가 발생 합니다.

이벤트가 발생하면 대리자를 통해 이벤트 처리기가 호출됩니다. 자세한 내용은 이벤트 처리 및 발생합니다.

또한 OnDataBound 메서드를 사용하면 파생 클래스가 대리자를 연결하지 않고도 이벤트를 처리할 수 있습니다. 이는 파생 클래스에서 이벤트를 처리하는 기본 방법입니다.

상속자 참고

재정의 하는 경우 OnDataBound(EventArgs) 파생된 클래스에서 호출 해야 기본 클래스 OnDataBound(EventArgs) 메서드 등록 된 대리자가 이벤트를 받도록 합니다.

적용 대상

추가 정보