Export (0) Print
Expand All

FormView.OnBubbleEvent Method

Handles an event passed up through the control hierarchy.

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

protected override bool OnBubbleEvent(
	Object source,
	EventArgs e
)

Parameters

source
Type: System.Object

The source of the event.

e
Type: System.EventArgs

An EventArgs that contains the event data.

Return Value

Type: System.Boolean
true to indicate the event should be passed further up the control hierarchy; otherwise, false.

The Control.OnBubbleEvent method is used by the control to optionally handle events passed up through the control hierarchy by the RaiseBubbleEvent method. It determines whether to handle an event by examining the properties of the EventArgs object contained in the e parameter. When an event needs to be handled, the method performs the appropriate action. Other events are ignored and passed up the control hierarchy. This method indicates whether to pass the event further up the control hierarchy through its return value.

The FormView control overrides the base implementation of this method to perform the appropriate action when one of the buttons recognized by the control is clicked. The following table lists the command buttons that the FormView control recognizes.

Button

CommandName value

Description

Cancel

"Cancel"

Used in updating or inserting operations to cancel the operation and to discard the values entered by the user. The FormView control then returns to the mode specified by the DefaultMode property.

Delete

"Delete"

Used in deleting operations to delete the displayed record from the data source. Raises the ItemDeleting and ItemDeleted events.

Edit

"Edit"

Used in updating operations to put the FormView control in edit mode. The content specified in the EditItemTemplate property is displayed for the data row.

Insert

"Insert"

Used in inserting operations to attempt to insert a new record in the data source with the values provided by the user. Raises the ItemInserting and ItemInserted events.

New

"New"

Used in inserting operations to put the FormView control in insert mode. The content specified in the InsertItemTemplate property is displayed for the data row.

Page

"Page"

Used in paging operations to represent a button in the pager row that performs paging. To specify the paging operation, set the CommandArgument property of the button to "Next", "Prev", "First", "Last", or the index of the page to which to navigate. Raises the PageIndexChanging and PageIndexChanged events.

NoteNote

This type of button is typically used only in the pager template.

Update

"Update"

Used in updating operations to attempt to update the displayed record in the data source with the values provided by the user. Raises the ItemUpdating and ItemUpdated events.

This version of the method returns true when one of these buttons is handled. For more information about event bubbling, see Events and Delegates.

Notes to Inheritors

When extending the FormView class, you can override this method to handle your own events. Make sure to use the return value to indicate whether the event should be passed further up the control hierarchy.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, 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.

Show:
© 2014 Microsoft