GridViewCommandEventArgs Class
TOC
Collapse the table of content
Expand the table of content

GridViewCommandEventArgs Class

 

Provides data for the RowCommand event.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

System::Object
  System::EventArgs
    System.Web.UI.WebControls::CommandEventArgs
      System.Web.UI.WebControls::GridViewCommandEventArgs

public ref class GridViewCommandEventArgs : CommandEventArgs

NameDescription
System_CAPS_pubmethodGridViewCommandEventArgs(GridViewRow^, Object^, CommandEventArgs^)

Initializes a new instance of the GridViewCommandEventArgs class using the specified row, source of the command, and event arguments.

System_CAPS_pubmethodGridViewCommandEventArgs(Object^, CommandEventArgs^)

Initializes a new instance of the GridViewCommandEventArgs class using the specified source of the command and event arguments.

NameDescription
System_CAPS_pubpropertyCommandArgument

Gets the argument for the command.(Inherited from CommandEventArgs.)

System_CAPS_pubpropertyCommandName

Gets the name of the command.(Inherited from CommandEventArgs.)

System_CAPS_pubpropertyCommandSource

Gets the source of the command.

System_CAPS_pubpropertyHandled

NameDescription
System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

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

System_CAPS_noteNote

The 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 RowDeleted or RowDeleting).

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

For more information about handling events, see NIB: Consuming Events.

For a list of initial property values for an instance of GridViewCommandEventArgs, see the GridViewCommandEventArgs constructor.

The following example demonstrates how to use the GridViewCommandEventArgs object passed to the event-handling method to determine the command name of the button that raised the event.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft