System.Web.UI.WebControls.LinkButton.OnCommand Method

Raises the LinkButton.Command event of the System.Web.UI.WebControls.LinkButton control.

Syntax

protected virtual void OnCommand (CommandEventArgs e)

Parameters

e
A System.Web.UI.WebControls.CommandEventArgs that contains the event data.

Remarks

The LinkButton.Command event is raised when the System.Web.UI.WebControls.LinkButton control is clicked. This event is commonly used when a command name, such as Sort, is associated with the System.Web.UI.WebControls.LinkButton control. This allows you to create multiple System.Web.UI.WebControls.LinkButton controls on a Web page and programmatically determine which System.Web.UI.WebControls.LinkButton control is clicked.

Note:

The LinkButton.Command event is raised through the control hierarchy in the form of the BubbleEvent.

Raising an event invokes the event handler through a delegate. For more information, see [<topic://cpconProvidingEventFunctionality>].

The LinkButton.OnCommand(CommandEventArgs) method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0