Rediger

Del via


ListViewCancelMode Enum

Definition

Determines the type of operation that the user was performing when the Cancel button was clicked in a ListView item.

public enum class ListViewCancelMode
public enum ListViewCancelMode
type ListViewCancelMode = 
Public Enum ListViewCancelMode
Inheritance
ListViewCancelMode

Fields

Name Value Description
CancelingEdit 0

The user canceled an edit operation.

CancelingInsert 1

The user canceled an insert operation.

Examples

The following example shows how to use the ListViewCancelMode enumeration to check which operation is being canceled in a ListView item.

protected void ContactsListView_ItemCanceling(object sender, ListViewCancelEventArgs e)
{
  //Check the operation that raised the event
  if (e.CancelMode == ListViewCancelMode.CancelingEdit)
  {
    // The update operation was canceled. Display the 
    // primary key of the item.
    Message.Text = "Update for the ContactID " + 
      ContactsListView.DataKeys[e.ItemIndex].Value.ToString()  + " canceled.";
  }
  else
  {
    Message.Text = "Insert operation canceled."; 
  }
}
Protected Sub ContactsListView_ItemCanceling(ByVal sender As Object, _
                                             ByVal e As ListViewCancelEventArgs)
  'Check the operation that raised the event
  If (e.CancelMode = ListViewCancelMode.CancelingEdit) Then
    ' The update operation was canceled. Display the 
    ' primary key of the item.
    Message.Text = "Update for the ContactID " & _
      ContactsListView.DataKeys(e.ItemIndex).Value.ToString() & " canceled."
  Else
    Message.Text = "Insert operation canceled."
  End If

End Sub

Remarks

The ListViewCancelMode enumeration is used to represent the type of operation that the user was performing when the Cancel button was clicked in a ListView item. (A Cancel button is a button whose CommandName property set to "Cancel".)

Applies to

See also