共用方式為


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按下 [取消] 按鈕時所執行的作業類型。 ([取消] 按鈕是一個按鈕,其 CommandName 屬性設定為 “Cancel”.)

適用於

另請參閱