Control.OnInit(EventArgs) Método

Definición

Genera el evento 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)

Parámetros

e
EventArgs

Objeto EventArgs que contiene los datos del evento.

Ejemplos

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

Comentarios

ASP.NET llama a este método para generar el Init evento. Si está desarrollando un control personalizado, puede invalidar este método para proporcionar procesamiento adicional. Si invalida este método, llame al método del OnInit control base para notificar a los suscriptores al evento.

Se aplica a

Consulte también