The ItemCommand event is raised when a button in the ListView control is clicked. This enables you to perform a custom routine whenever this event occurs.
Buttons in a ListView control can also invoke built-in functionality of the control. The following table lists values that you can use with the CommandName property of a button in order to invoke built-in functionality.
The ItemCommand event is also raised when a button that is listed in the previous table is clicked. However, it is recommended that you use the events listed in the table. The ItemCommand event is usually used to handle custom operations.
A ListViewCommandEventArgs object is passed to the event handler, which enables you to determine the command name and command argument of the button that was clicked. To determine the command name, use the CommandEventArgs..::.CommandName property. To determine the command argument, use the CommandEventArgs..::.CommandArgument property. To access the control that raised the event, use the ListViewCommandEventArgs..::.CommandSource property.
For more information about how to handle events, see Consuming Events.