ListView.OnItemCommand(ListViewCommandEventArgs) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Raises the ItemCommand event.
protected:
virtual void OnItemCommand(System::Web::UI::WebControls::ListViewCommandEventArgs ^ e);
protected virtual void OnItemCommand (System.Web.UI.WebControls.ListViewCommandEventArgs e);
abstract member OnItemCommand : System.Web.UI.WebControls.ListViewCommandEventArgs -> unit
override this.OnItemCommand : System.Web.UI.WebControls.ListViewCommandEventArgs -> unit
Protected Overridable Sub OnItemCommand (e As ListViewCommandEventArgs)
Parameters
The event data.
Remarks
The ItemCommand event is raised when a button in an item template is clicked, but before the command is executed. This enables you to perform a custom routine in response to the supplied CommandName or CommandArgument value whenever this event occurs.
The OnItemCommand method is called by the ListView control to raise the ItemCommand event. It is typically used by control developers when extending the ListView class.
Raising an event invokes the event handler through a delegate. For more information, see Handling and Raising Events.
The OnItemCommand method also enables derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.
Notes to Inheritors
When you override OnItemCommand(ListViewCommandEventArgs) in a derived class, call the base class's OnItemCommand(ListViewCommandEventArgs) method so that registered delegates receive the event.