Page.RaisePostBackEvent Method
Notifies the server control that caused the postback that it should handle an incoming postback event.
Assembly: System.Web (in System.Web.dll)
'Declaration Protected Overridable Sub RaisePostBackEvent ( _ sourceControl As IPostBackEventHandler, _ eventArgument As String _ ) 'Usage Dim sourceControl As IPostBackEventHandler Dim eventArgument As String Me.RaisePostBackEvent(sourceControl, _ eventArgument)
Parameters
- sourceControl
- Type: System.Web.UI.IPostBackEventHandler
The ASP.NET server control that caused the postback. This control must implement the IPostBackEventHandler interface.
- eventArgument
- Type: System.String
The postback argument.
The Page object 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.
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.
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
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.