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

GridFocusedRowChangedEventArgs Class

Contains data for the FocusedRowChanged event.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public class GridFocusedRowChangedEventArgs :
    GridFocusedRowChangedEventArgsBase

#Remarks

The FocusedRowChanged event allows you to handle focused row changes. The GridFocusedRowChangedEventArgs object contains data related to the event.

In the following code snippet, the FocusedRowChanged event handler displays additional information about the currently focused employee.

razor
<DxGrid Data="GridData" PageSize="5"
        FocusedRowEnabled="true" FocusedRowChanged="Grid_FocusedRowChanged">
    <Columns>
        <DxGridDataColumn FieldName="FirstName" />
        <DxGridDataColumn FieldName="LastName" />
        <DxGridDataColumn FieldName="Title" />
        <DxGridDataColumn FieldName="HireDate" />
    </Columns>
</DxGrid>

<DxFormLayout>
    <DxFormLayoutItem Caption="@MemoCaption" CaptionPosition="CaptionPosition.Vertical" 
                      Visible="@ShowMemo" ColSpanMd="12">
        <DxMemo Text=@Notes Rows="4"/>
    </DxFormLayoutItem>
</DxFormLayout>

@code {
    string MemoCaption { get; set; }
    string Notes { get; set; }
    bool ShowMemo { get; set; }

    void Grid_FocusedRowChanged(GridFocusedRowChangedEventArgs e) {
        if(e.DataItem != null) {
            ShowMemo = true;
            var employee = (Employee)e.DataItem;
            MemoCaption = employee.FirstName + " " + employee.LastName + " details:";
            Notes = employee.Notes;
        }
        else {
            ShowMemo = false;
        }
    }

    object GridData { get; set; }
    protected override async Task OnInitializedAsync() {
        GridData = await NwindDataService.GetEmployeesAsync();
    }
}

Grid Focused Row

Run Demo: Grid - Focused Row

#Inheritance

Object
DevExpress.Blazor.Internal.GridEventArgsBase
DevExpress.Blazor.Internal.GridFocusedRowChangedEventArgsBase
GridFocusedRowChangedEventArgs
See Also