Page.RaisePostBackEvent(IPostBackEventHandler, String) Método

Definición

Informa al control de servidor que originó el postback de que debería controlar un evento de postback entrante.Notifies the server control that caused the postback that it should handle an incoming postback event.

protected:
 virtual void RaisePostBackEvent(System::Web::UI::IPostBackEventHandler ^ sourceControl, System::String ^ eventArgument);
protected virtual void RaisePostBackEvent (System.Web.UI.IPostBackEventHandler sourceControl, string eventArgument);
abstract member RaisePostBackEvent : System.Web.UI.IPostBackEventHandler * string -> unit
override this.RaisePostBackEvent : System.Web.UI.IPostBackEventHandler * string -> unit
Protected Overridable Sub RaisePostBackEvent (sourceControl As IPostBackEventHandler, eventArgument As String)

Parámetros

sourceControl
IPostBackEventHandler

Control de servidor ASP.NET que provocó el postback.The ASP.NET server control that caused the postback. Este control debe implementar la interfaz IPostBackEventHandler.This control must implement the IPostBackEventHandler interface.

eventArgument
String

El argumento de postback.The postback argument.

Ejemplos

En el ejemplo siguiente se usa el método RaisePostBackEvent para notificar a ASP.NET que se genera un evento de devolución de llamada cuando se hace clic en un control de servidor de userButton personalizado.The following example uses the RaisePostBackEvent method to notify ASP.NET that a post-back event is raised when a custom userButton server control is clicked.

void DisplayUserName(Object sender, EventArgs ea) 
{
   Response.Write("Welcome to " + Server.HtmlEncode(userName.Text));
}
void RaiseEvent(Object sender, EventArgs ea)
{
   // Raise a post back event for a control.
   this.RaisePostBackEvent(userButton, "");
}
void Page_Load(Object sender, EventArgs ea)
{
   // Register a control as one that requires postback handling.
   this.RegisterRequiresRaiseEvent(userButton);
}
    Sub DisplayUserName(Sender As Object, e As EventArgs) 
       Response.Write("Welcome to " + Server.HtmlEncode(userName.Text))
    End Sub

   Sub MyRaiseEvent(Sender As Object, e As EventArgs)
       'Raises a post back event for a control.
        Me.RaisePostBackEvent(userButton, "")
   End Sub 
    
    Sub Page_Load(Sender As Object, e As EventArgs)

      'Registers a control as one that requires postback handling
      Me.RegisterRequiresRaiseEvent(userButton)
  End Sub

Comentarios

El objeto Page llama al método RaisePostBackEvent cuando se produce un postback.The Page object calls the RaisePostBackEvent method when a postback occurs. Esta llamada se produce en el ciclo de vida de la página después de que la carga y la notificación de cambios se hayan completado, pero antes de que se produzca la preprocesamiento.This call occurs in the page life cycle after loading and change notification are complete but before prerendering occurs.

Se aplica a

Consulte también: