ListViewCancelMode 枚举

定义

确定在单击 ListView 项中的“取消”按钮时用户正在执行的操作的类型

public enum class ListViewCancelMode
public enum ListViewCancelMode
type ListViewCancelMode = 
Public Enum ListViewCancelMode
继承
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 按钮。)

适用于

另请参阅