Export (0) Print
Expand All
Expand Minimize

Page.RaisePostBackEvent Method

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

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

protected virtual void RaisePostBackEvent(
	IPostBackEventHandler sourceControl,
	string 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.


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);
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft