ListViewCancelMode 枚举

定义

确定在单击 ListView 项中的“取消”按钮时用户正在执行的操作的类型。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
继承
ListViewCancelMode

字段

CancelingEdit 0

用户取消了一个编辑操作。The user canceled an edit operation.

CancelingInsert 1

用户取消了一个插入操作。The user canceled an insert operation.

示例

下面的示例演示如何使用ListViewCancelMode枚举来检查要ListView在项中取消的操作。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

注解

枚举用于表示在ListView项中单击 "取消" 按钮时用户正在执行的操作的类型。 ListViewCancelModeThe 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. ("取消" 按钮是其CommandName属性设置为 "取消" 的按钮。)(A Cancel button is a button whose CommandName property set to "Cancel".)

适用于

另请参阅