CommandEventArgs Class
Assembly: System.Web (in system.web.dll)
The Command event is raised when a Button or ImageButton control is clicked.
The CommandEventArgs object contains data about the Command event that can be accessed in the event handler. Using the properties available in the CommandEventArgs class, you can determine the name of the command to perform, such as Sort, in addition to an optional argument that supplements the command, such as Ascending.
For a list of initial property values for an instance of CommandEventArgs, see the CommandEventArgs constructor.
For more information about handling events, see Consuming Events.
The following example demonstrates how to access the properties in CommandEventArgs to determine the command to perform. This example specifies the event handler declaratively, using the OnClick property of the Button control.
The following code example demonstrates how to specify the event handler and programmatically add it to the event in the Page_Load method.
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.