BaseDataBoundControl.OnDataBound(EventArgs) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
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)
매개 변수
예제
다음 코드 예제에서는 파생된 데이터 바인딩된 컨트롤 클래스에 의해 이벤트를 발생 OnDataBound 하려면 메서드를 사용 하는 방법을 DataBound 보여 줍니다. 및 GetData 메서드를 PerformDataBinding 사용하여 데이터를 컨트롤에 바인딩한 후 데이터 바인딩 컨트롤은 데이터 바인딩이 완료되었음을 알리는 이벤트를 발생합니다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
설명
이 메서드는 컨트롤과 연결된 데이터 바인딩 논리가 완료되었음을 서버 컨트롤에 알깁니다.
Important
이 DataBind 메서드는 파생된 모든 컨트롤에서 봉인됩니다 BaseDataBoundControl. 데이터 바인딩된 컨트롤은 데이터를 바인딩하는 메서드 대신 재정 PerformDataBinding 의 DataBind 해야 합니다. 재정 DataBind 의되면 OnDataBinding 이벤트와 OnDataBound 이벤트가 순서대로 발생합니다.
이벤트를 발생시키는 경우 대리자를 통해 이벤트 처리기가 호출됩니다. 자세한 내용은 이벤트 처리 및 발생을 참조하세요.
또한 이 OnDataBound 메서드를 사용하면 파생 클래스가 대리자를 연결하지 않고도 이벤트를 처리할 수 있습니다. 파생 클래스에서 이벤트를 처리하기 위한 기본 설정 기술입니다.
상속자 참고
파생 클래스에서 OnDataBound(EventArgs)를 재정의할 때, 등록된 대리자가 이벤트를 받도록 기본 클래스의 OnDataBound(EventArgs) 메서드를 반드시 호출해야 합니다.