ListViewCancelEventArgs Class

 

Provides data for the ItemCanceling event.

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

System::Object
  System::EventArgs
    System.ComponentModel::CancelEventArgs
      System.Web.UI.WebControls::ListViewCancelEventArgs

public ref class ListViewCancelEventArgs : CancelEventArgs

NameDescription
System_CAPS_pubmethodListViewCancelEventArgs(Int32, ListViewCancelMode)

Initializes a new instance of the ListViewCancelEventArgs class.

NameDescription
System_CAPS_pubpropertyCancel

Gets or sets a value indicating whether the event should be canceled.(Inherited from CancelEventArgs.)

System_CAPS_pubpropertyCancelMode

Gets the data-entry mode that the ListView control was in when the Cancel button was clicked.

System_CAPS_pubpropertyItemIndex

Gets the index of the item that contains the Cancel button that raised the event.

NameDescription
System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

The ListView control raises the ItemCanceling event when the Cancel button is clicked, but before exiting insert or edit mode. (A Cancel button is a button whose CommandName property is set to "Cancel") This enables you to provide an event-handling method that performs a custom routine whenever this event occurs, such as stopping the cancel operation if it would put the item in an unwanted state.

A ListViewCancelEventArgs object is passed to the event-handling method. This object enables you to determine the index of the item that contains the Cancel button that raised the event. You can also determine what operation was canceled. To stop the cancel operation, set the Cancel property to true.

For a list of initial property values for an instance of the ListViewCancelEventArgs class, see the ListViewCancelEventArgs constructor.

The following example shows how to use the ListViewCancelEventArgs object to display a message when the user cancels the insert or update operation in a ListView control. The ListViewCancelEventArgs object is passed to the event-handling method for the ItemCanceling event.

System_CAPS_security Security Note

This example contains a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: