GridRowClickEventArgs Class
Contains data for the RowClick and RowDoubleClick events.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v21.2.dll
NuGet Package: DevExpress.Blazor
Declaration
public class GridRowClickEventArgs
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")}'. ";
}
}
The Grid also allows users to select rows by mouse clicks. To enable selection mode, set the AllowSelectRowByClick property to true
. 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.