Edit

Share via


FormView.OnBubbleEvent(Object, EventArgs) Method

Definition

Handles an event passed up through the control hierarchy.

protected:
 override bool OnBubbleEvent(System::Object ^ source, EventArgs ^ e);
protected override bool OnBubbleEvent (object source, EventArgs e);
override this.OnBubbleEvent : obj * EventArgs -> bool
Protected Overrides Function OnBubbleEvent (source As Object, e As EventArgs) As Boolean

Parameters

source
Object

The source of the event.

e
EventArgs

An EventArgs that contains the event data.

Returns

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

Remarks

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. Note: 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 Handling and Raising Events.

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.

Applies to

See also