ListViewCancelMode Enumeration
TOC
Collapse the table of content
Expand the table of content

ListViewCancelMode Enumeration

.NET Framework (current version)
 

Determines the type of operation that the user was performing when the Cancel button was clicked in a ListView item.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public enum ListViewCancelMode

Member nameDescription
CancelingEdit

The user canceled an edit operation.

CancelingInsert

The user canceled an insert operation.

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. (A Cancel button is a button whose CommandName property set to "Cancel".)

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."; 
  }
}

.NET Framework
Available since 3.5
Return to top
Show:
© 2016 Microsoft