GridRowClickEventArgs Class
Contains data for the RowClick and RowDoubleClick events.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public class GridRowClickEventArgs :
GridRowClickEventArgsBase
Remarks
Use the RowClick and RowDoubleClick events to handle clicks on grid rows (data or group rows).
Use the GridRowClickEventArgs
event arguments (Column, VisibleIndex, and so on) to access a clicked row and other grid data.
@inject WeatherForecastService ForecastService
<DxGrid Data="@Data"
RowClick="OnRowClick">
<Columns>
<DxGridDataColumn FieldName="Date" />
<DxGridDataColumn FieldName="TemperatureC" Caption="@("Temp. (\x2103)")" Width="120px" />
<DxGridDataColumn FieldName="TemperatureF" Caption="@("Temp. (\x2109)")" Width="120px" />
</Columns>
</DxGrid>
@Alert
@code {
public string Alert { get; set; } = "";
object Data { get; set; }
protected override void OnInitialized() {
Data = ForecastService.GetForecast();
}
void OnRowClick(GridRowClickEventArgs e) {
Alert = $"The row {e.VisibleIndex} has been clicked. The row value is '{e.Grid.GetRowValue(e.VisibleIndex, "Date")}'. ";
}
}
Enable the AllowSelectRowByClick property to allow users to select and deselect rows by mouse clicks, tap gestures, and keyboard shortcuts. To select a range of rows, users should hold down the Shift key and click the first and last rows in the range. To add/remove a row to/from selection, users should hold down the Ctrl key and click the row.
<DxGrid Data="@DataSource"
RowClick="OnRowClick"
AllowSelectRowByClick="true"
...>
@*...*@
</DxGrid>
You can use the GridRowClickEventArgs.ShiftKey and GridRowClickEventArgs.CtrlKey event arguments to define whether the Shift or Ctrl key was pressed when a user clicked rows.