ControlAdapter.OnInit(EventArgs) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
연결된 컨트롤에 OnInit(EventArgs) 대한 메서드를 재정의합니다.
protected public:
virtual void OnInit(EventArgs ^ e);
protected internal virtual void OnInit(EventArgs e);
abstract member OnInit : EventArgs -> unit
override this.OnInit : EventArgs -> unit
Protected Friend Overridable Sub OnInit (e As EventArgs)
매개 변수
예제
다음 코드 샘플은 클래스에서 사용자 지정 컨트롤 어댑터를 파생합니다 ControlAdapter . 그런 다음 메서드를 재정의 OnInit 하여 연결된 컨트롤에 속성을 설정하고 기본 메서드를 호출하여 컨트롤 초기화를 완료합니다.
#using <System.Web.dll>
#using <System.dll>
using namespace System;
using namespace System::Web::UI;
using namespace System::Web::UI::Adapters;
public ref class CustomControlAdapter: public ControlAdapter
{
// Override the ControlAdapter default OnInit implementation.
protected:
virtual void OnInit( EventArgs^ e ) override
{
// Make the control invisible.
Control->Visible = false;
// Call the base method, which calls OnInit of the control,
// which raises the control Init event.
ControlAdapter::OnInit( e );
}
};
using System;
using System.Web.UI;
using System.Web.UI.Adapters;
public class CustomControlAdapter : ControlAdapter
{
// Override the ControlAdapter default OnInit implementation.
protected override void OnInit (EventArgs e)
{
// Make the control invisible.
Control.Visible = false;
// Call the base method, which calls OnInit of the control,
// which raises the control Init event.
base.OnInit(e);
}
}
Imports System.Web.UI
Imports System.Web.UI.Adapters
Public Class CustomControlAdapter
Inherits ControlAdapter
' Override the ControlAdapter default OnInit implementation.
Protected Overrides Sub OnInit(ByVal e As EventArgs)
' Make the control invisible.
Control.Visible = False
' Call the base method, which calls OnInit of the control,
' which raises the control Init event.
MyBase.OnInit(e)
End Sub
End Class
설명
개체에 Control 연결된 어댑터가 있고 메서드가 재정의 OnInit 된 경우 재정의 Control.OnInit 메서드가 메서드 대신 호출됩니다.
컨트롤 수명 주기 단계에서 대상별 처리를 OnInit 수행하도록 재정 Initialize 의합니다. 일반적으로 컨트롤을 만들 때 수행되는 함수입니다.
상속자 참고
클래스에서 ControlAdapter 상속하고 어댑터가 메서드를 재정 OnInit(EventArgs) 의하는 경우 어댑터는 해당 기본 클래스 메서드를 호출해야 하며, 이 메서드는 메서드를 OnInit(EventArgs) 호출해야 합니다. 메서드가 OnInit(EventArgs) 호출 Init 되지 않으면 이벤트가 발생하지 않습니다.