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

備註

ListViewCancelMode 列舉是用來代表使用者在 ListView 專案中按一下 [取消] 按鈕時所執行的作業類型。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. ([取消] 按鈕是其 CommandName 屬性設定為 [取消] 的按鈕)。(A Cancel button is a button whose CommandName property set to "Cancel".)

適用於

另請參閱