Control.OnInit(EventArgs) 메서드

정의

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

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

매개 변수

e
EventArgs

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

예제

// Override the OnInit method to set _text to
// a default value if it is null.
[System.Security.Permissions.PermissionSet
    (System.Security.Permissions.SecurityAction.Demand, 
     Name="FullTrust")] 
protected override void OnInit(EventArgs e)
{
   base.OnInit(e);
   if ( _text == null)
        _text = "Here is some default text.";
}
' Override the OnInit method to set _text to 
' a default value if it is null.
<System.Security.Permissions.PermissionSetAttribute( _
  System.Security.Permissions.SecurityAction.Demand, _
    Name:="FullTrust")> _
Protected Overrides Sub OnInit(ByVal e As EventArgs)
    MyBase.OnInit(e)
    If _text Is Nothing Then
        _text = "Here is some default text."
    End If
End Sub

설명

ASP.NET 이 메서드를 호출하여 이벤트를 발생합니다 Init . 사용자 지정 컨트롤을 개발하는 경우 추가 처리를 제공하기 위해 이 메서드를 재정의할 수 있습니다. 이 메서드를 재정의하는 경우 기본 컨트롤의 OnInit 메서드를 호출하여 구독자에게 이벤트를 알립니다.

적용 대상

추가 정보