Page.RaisePostBackEvent(IPostBackEventHandler, String) Metodo

Definizione

Notifica al controllo server che ha causato il postback che dovrà gestire un evento di postback in entrata.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)

Parametri

sourceControl
IPostBackEventHandler

Controllo server ASP.NET che ha causato il postback.The ASP.NET server control that caused the postback. Questo controllo deve implementare l'interfaccia IPostBackEventHandler.This control must implement the IPostBackEventHandler interface.

eventArgument
String

Argomento relativo al postback.The postback argument.

Esempi

Nell'esempio seguente viene utilizzato il metodo RaisePostBackEvent per notificare a ASP.NET che viene generato un evento di postback quando viene fatto clic su un controllo server userButton personalizzato.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

Commenti

L'oggetto Page chiama il metodo RaisePostBackEvent quando si verifica un postback.The Page object calls the RaisePostBackEvent method when a postback occurs. Questa chiamata si verifica nel ciclo di vita della pagina dopo il caricamento e la notifica delle modifiche è stata completata ma prima che venga eseguito il prerendering.This call occurs in the page life cycle after loading and change notification are complete but before prerendering occurs.

Si applica a

Vedi anche