ListViewCancelMode Enum   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
确定在单击 ListView 项中的“取消”按钮时用户正在执行的操作的类型。
public enum class ListViewCancelModepublic enum ListViewCancelModetype ListViewCancelMode = Public Enum ListViewCancelMode- 继承
字段
| 名称 | 值 | 说明 | 
|---|---|---|
| CancelingEdit | 0 | 用户取消了一个编辑操作。 | 
| CancelingInsert | 1 | 用户取消了一个插入操作。 | 
示例
以下示例演示如何使用 ListViewCancelMode 枚举来检查在项 ListView 中取消的操作。
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
注解
              ListViewCancelMode枚举用于表示在项目中单击ListView“取消”按钮时用户执行的操作类型。  (“取消”按钮是属性设置为“Cancel”的 CommandName 按钮。)