This documentation is archived and is not being maintained.

Page.RaisePostBackEvent Method

Notifies the server control that caused the postback that it should handle an incoming post back event.

[Visual Basic]
Protected Overridable Sub RaisePostBackEvent( _
   ByVal sourceControl As IPostBackEventHandler, _
   ByVal eventArgument As String _
protected virtual void RaisePostBackEvent(
 IPostBackEventHandler sourceControl,
 string eventArgument
protected: virtual void RaisePostBackEvent(
 IPostBackEventHandler* sourceControl,
 String* eventArgument
protected function RaisePostBackEvent(
   sourceControl : IPostBackEventHandler,
 eventArgument : String


The ASP.NET server control that caused the postback. This control must implement the IPostBackEventHandler interface.
The post-back argument.


The Page calls the RaisePostBackEvent method when a postback occurs. This call occurs in the page life cycle after loading and change notification are complete but before prerendering occurs.


[Visual Basic, C#] 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.

[Visual Basic] 
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
      End Sub

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.

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

Page Class | Page Members | System.Web.UI Namespace | IPostBackEventHandler