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 되지 않으면 이벤트가 발생하지 않습니다.
적용 대상
추가 정보
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기