Skip to main content
A newer version of this page is available. .

ASPxClientGridView.GetFocusedRowIndex Method

Returns the focused row’s index.

Declaration

GetFocusedRowIndex(): number

Returns

Type Description
number

A zero-based integer that specifies the focused row’s index.

Remarks

The GetFocusedRowIndex method returns -1:

Example

This example illustrates how to dynamically display a focused employee’s photo and details outside the grid.

Note

For a full example, see the ASPxGridView - Focused Row (WebForms) and Grid View - focused Row (MVC) demos.

WebForms:

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" DataSourceID="EmployeesDataSource"
    KeyFieldName="EmployeeID" PreviewFieldName="Notes" AutoGenerateColumns="False" 
    EnableRowsCache="false" Width="100%">
    <Columns>
    ...
    </Columns>
    <ClientSideEvents FocusedRowChanged="function(s, e) { OnGridFocusedRowChanged(); }" />
</dx:ASPxGridView>

MVC:

@Html.DevExpress().GridView(settings => {
    settings.Name = "grid";
    settings.KeyFieldName = "EmployeeID";
    ...
    settings.ClientSideEvents.FocusedRowChanged = "OnGridFocusedRowChanged";
}).Bind(Model).GetHtml()

Result:

ASPxGridView-FocusedRow

See Also