Skip to main content
.NET Framework Class Library
ControlRaiseBubbleEvent Method

Assigns any sources of the event and its information to the control's parent.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)
Syntax
Protected Sub RaiseBubbleEvent ( _
	source As [%$TOPIC/wt8sh39w_en-us_VS_110_1_0_0_0_0%], _
	args As [%$TOPIC/wt8sh39w_en-us_VS_110_1_0_0_0_1%] _
)
protected void RaiseBubbleEvent(
	[%$TOPIC/wt8sh39w_en-us_VS_110_1_0_1_0_0%] source,
	[%$TOPIC/wt8sh39w_en-us_VS_110_1_0_1_0_1%] args
)
protected:
void RaiseBubbleEvent(
	[%$TOPIC/wt8sh39w_en-us_VS_110_1_0_2_0_0%]^ source, 
	[%$TOPIC/wt8sh39w_en-us_VS_110_1_0_2_0_1%]^ args
)
member RaiseBubbleEvent : 
        source:[%$TOPIC/wt8sh39w_en-us_VS_110_1_0_3_0_0%] * 
        args:[%$TOPIC/wt8sh39w_en-us_VS_110_1_0_3_0_1%] -> unit

Parameters

source
Type: SystemObject

The source of the event.

args
Type: SystemEventArgs

An EventArgs object that contains the event data.

Remarks

ASP.NET server controls such as the Repeater, DataList and GridView Web controls can contain child controls that raise events. For example, each row in a GridView control can contain one or more buttons created dynamically by templates. Rather than each button raising an event individually, events from the nested controls are "bubbled"—that is, they are sent to the control's parent. The parent in turn raises a generic event called RowCommand with parameter values. These values allow you to determine which individual control that raised the original event. By responding to this single event, you can avoid having to write individual event-handling methods for child controls.

While you cannot override this method, controls you author can handle or raise bubbled events by overriding the OnBubbleEvent method.

Examples

The following code example demonstrate how to create a custom class, ChildControl, overriding the ButtonOnClick method to call the RaiseBubbleEvent method that sends the ButtonClick event to its parent ASP.NET server control. When the user clicks a button in an ASP.NET page that includes an instance of ChildControl, it raises the OnBubbleEvent method on the parent control that contains the instance of ChildControl and writes the string "The ChildControl class OnClick method is called" to the page.

Public Class ChildControl
   Inherits Button

   <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
   Protected Overrides Sub OnClick(e As EventArgs)
      MyBase.OnClick(e)
      Context.Response.Write("<br><br>ChildControl's OnClick called.")
      ' Bubble this event to parent.
      RaiseBubbleEvent(Me, e)
   End Sub 'OnClick
End Class 'ChildControl 
public class ChildControl : Button
{
   [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 
   protected override void OnClick(EventArgs e) 
   {
      base.OnClick(e);
      Context.Response.Write("<br><br>ChildControl's OnClick called.");
      // Bubble this event to parent.
      RaiseBubbleEvent(this, e);
   }
Version Information

.NET Framework

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

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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