Редагувати

Поділитися через


ListView.OnItemCanceling(ListViewCancelEventArgs) Method

Definition

Raises the ItemCanceling event.

protected:
 virtual void OnItemCanceling(System::Web::UI::WebControls::ListViewCancelEventArgs ^ e);
protected virtual void OnItemCanceling (System.Web.UI.WebControls.ListViewCancelEventArgs e);
abstract member OnItemCanceling : System.Web.UI.WebControls.ListViewCancelEventArgs -> unit
override this.OnItemCanceling : System.Web.UI.WebControls.ListViewCancelEventArgs -> unit
Protected Overridable Sub OnItemCanceling (e As ListViewCancelEventArgs)

Parameters

e
ListViewCancelEventArgs

The event data.

Exceptions

There is no handler for the ItemCanceling event.

Remarks

The ListView control raises the ItemCanceling event when a Cancel button in the control is clicked, but before exiting insert or edit mode. (A Cancel button is a button control whose CommandName property is set to "Cancel".) This enables you to perform a custom routine whenever this event occurs, such as stopping the cancel operation if it would put the item in an unwanted state.

The OnItemCanceling method is called by the ListView control to raise the ItemCanceling event. It is typically used by control developers when extending the ListView class.

Raising an event invokes the event handler through a delegate. For more information, see Handling and Raising Events.

The OnItemCanceling method also enables derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Notes to Inheritors

When you override OnItemCanceling(ListViewCancelEventArgs) in a derived class, call the base class's OnItemCanceling(ListViewCancelEventArgs) method so that registered delegates receive the event.

Applies to

See also