ASPxGridView.RowCommand Event
Fires when a control contained within a templated grid row raises the Command event.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Event Data
The RowCommand event's data class is ASPxGridViewRowCommandEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
CommandArgs | Gets the argument for the command. |
CommandSource | Gets the source of the command. |
KeyValue | Gets an object that uniquely identifies the data row. Inherited from ASPxGridViewItemEventArgs. |
VisibleIndex | Gets the visible index of the data row. Inherited from ASPxGridViewItemEventArgs. |
Remarks
The ASPxGridView control allows the contents of its rows to be customized through defining templates. A template is a set of HTML elements and controls which constitute a layout for a particular item. See the Grid Elements that Support Templates topic to learn more about which row element templates are available within the ASPxGridView.
The RowCommand event is fired when any control contained within a templated grid row raises the Command event. The RowCommand event is commonly used when a specific command name is associated with a button control. This allows you to create multiple button controls within different templated rows and programmatically determine which button control is clicked.
Write an RowCommand event handler to perform specific actions each time the Command event is raised by any control contained within any templated grd row. The RowCommand event provides a parameter of the ASPxGridViewRowCommandEventArgs type.
Example
protected void grid_RowCommand(object sender, ASPxGridViewRowCommandEventArgs e) {
ASPxGridView grid = (ASPxGridView)sender;
object id = e.KeyValue;
string filename = grid.GetRowValuesByKeyValue(id, "CategoryName").ToString();
...
}