System.Web 2.0.0.0 System.Web.UI.WebControls.CommandEventArgs

The event is raised when a button within the control is clicked. This allows you to provide an event-handling method that performs a custom routine whenever this event occurs.

Buttons within a control can also invoke some of the built-in functionality of the control. To perform one of these operations, set the CommandName property of a button to one of the values in the following table.

CommandName value

Description

"Cancel"

Cancels an edit or insert operation and returns the control to the mode specified by the property. Raises the and events.

"Delete"

Deletes the current record. Raises the and events.

"Edit"

Puts the control in edit mode. Raises the and events.

"Insert"

Inserts the current record in the data source. Raises the and events.

"New"

Puts the control in insert mode. Raises the and events.

"Page"

Performs a paging operation. Set the CommandArgument property of the button to "First", "Last", "Next", "Prev", or a page number to specify the type of paging operation to perform. Raises the and events.

"Update"

Updates the current record in the data source. Raises the and events.

Although the event is raised when a button listed in the previous table is clicked, it is recommended that you use the events listed in the table for the operation.

A object is passed to the event-handling method, which allows you to determine the command name and command argument of the button clicked. To determine the command name and command argument, use the and properties, respectively. You can also access the button control that raised the event by using the property.

For more information about handling events, see Consuming Events.

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

Provides data for the event.

- Constructor
  To be added.
  To be added.

  Use this constructor to initialize a new instance of the class.

  The following table shows the initial property values for an instance of .

  Property

  Initial value

  The value of the property of the contained in the parameter.

  The value of the property of the contained in the parameter.

  The object contained in the parameter.

  This constructor is used primarily by control developers when raising events.

  Initializes a new instance of the class.

  2.0.0.0
- Property
  System.Object To be added.

  Use the property to access the properties of the control that raised the event. In the case of a object, the control is the button that was clicked by the user.

  Gets the control that raised the event.

  2.0.0.0