Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GridRowClickEventArgs Class

Contains data for the RowClick and RowDoubleClick events.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
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")}'. ";
    }
}

Grid - Row Click

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.

Razor
<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.

#Inheritance

Object
DevExpress.Blazor.Internal.GridEventArgsBase
DevExpress.Blazor.Internal.GridRowClickEventArgsBase
GridRowClickEventArgs
See Also