System.Web.UI.WebControls.GridViewCommandEventArgs Class

Provides data for the GridView.RowCommand event.

See Also: GridViewCommandEventArgs Members


public class GridViewCommandEventArgs : CommandEventArgs


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


The System.Web.UI.WebControls.GridView control also raises other specialized events when certain buttons are clicked (buttons with the CommandName property set to "Delete", "Update", and "Page" for example). When using one of these buttons, you should consider handling one of the specialized events provided by the control (such as GridView.RowDeleted or GridView.RowDeleting).

A System.Web.UI.WebControls.GridViewCommandEventArgs 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 CommandEventArgs.CommandName and CommandEventArgs.CommandArgument properties, respectively. You can also access the button control that raised the event by using the GridViewCommandEventArgs.CommandSource property.

For more information about handling events, see Consuming Events.

For a list of initial property values for an instance of System.Web.UI.WebControls.GridViewCommandEventArgs, see the erload:System.Web.UI.WebControls.GridViewCommandEventArgs.#ctor constructor.


Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions:
Since: .NET 2.0