ListView.OnItemCanceling(ListViewCancelEventArgs) Método

Definição

Aciona o evento ItemCanceling.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)

Parâmetros

e
ListViewCancelEventArgs

Os dados do evento.The event data.

Exceções

Não há nenhum manipulador para o evento ItemCanceling.There is no handler for the ItemCanceling event.

Comentários

O ListView controle gera o ItemCanceling evento quando um botão de cancelamento no controle é clicado, mas antes de sair do modo de inserção ou de edição.The ListView control raises the ItemCanceling event when a Cancel button in the control is clicked, but before exiting insert or edit mode. (Um botão de cancelamento é um controle de botão cuja CommandName propriedade está definida como "Cancelar".) Isso permite que você execute uma rotina personalizada sempre que esse evento ocorrer, como parar a operação de cancelamento se colocar o item em um estado indesejado.(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.

O OnItemCanceling método é chamado pelo ListView controle para gerar o ItemCanceling evento.The OnItemCanceling method is called by the ListView control to raise the ItemCanceling event. Normalmente, ele é usado por desenvolvedores de controle ao estender a ListView classe.It is typically used by control developers when extending the ListView class.

A geração de um evento invoca o manipulador de eventos por meio de um delegado.Raising an event invokes the event handler through a delegate. Para obter mais informações, consulte manipulando e gerando eventos.For more information, see Handling and Raising Events.

O OnItemCanceling método também permite que classes derivadas manipulem o evento sem anexar um delegado.The OnItemCanceling method also enables derived classes to handle the event without attaching a delegate. Essa é a técnica preferida para manipular o evento em uma classe derivada.This is the preferred technique for handling the event in a derived class.

Notas aos Herdeiros

Quando você substitui OnItemCanceling(ListViewCancelEventArgs) em uma classe derivada, chame o método da classe base OnItemCanceling(ListViewCancelEventArgs) para que os delegados registrados recebam o evento.When you override OnItemCanceling(ListViewCancelEventArgs) in a derived class, call the base class's OnItemCanceling(ListViewCancelEventArgs) method so that registered delegates receive the event.

Aplica-se a

Confira também