Control.OnInit(EventArgs) Metoda

Definice

Init Vyvolá událost.

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)

Parametry

e
EventArgs

Objekt EventArgs , který obsahuje data události.

Příklady

// 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

Poznámky

ASP.NET volá tuto metodu k vyvolání Init události. Pokud vyvíjíte vlastní ovládací prvek, můžete tuto metodu přepsat za účelem dalšího zpracování. Pokud tuto metodu přepíšete, voláním metody základního OnInit ovládacího prvku upozorněte odběratele na událost.

Platí pro

Viz také