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 , чтобы уведомить подписчиков о событии.

Применяется к

См. также раздел