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
)
protected void RaisePostBackEvent (
	IPostBackEventHandler sourceControl, 
	String eventArgument
)
protected function RaisePostBackEvent (
	sourceControl : IPostBackEventHandler, 
	eventArgument : String
)
Not applicable.

Parameters

sourceControl

The ASP.NET server control that caused the postback. This control must implement the IPostBackEventHandler interface.

eventArgument

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

void DisplayUserName(Object sender, EventArgs ea) 
{
    get_Response().Write("Welcome to " 
        + get_Server().HtmlEncode(userName.get_Text()));
} //DisplayUserName
      
void RaiseEvent(Object sender, EventArgs ea)
{
    // Raise a post back event for a control.
    this.RaisePostBackEvent(userButton, "");
} //RaiseEvent
      
void Page_Load(Object sender, EventArgs ea)
{
    // Register a control as one that requires postback handling.
    this.RegisterRequiresRaiseEvent(userButton);
} //Page_Load    

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft