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:
- if the ASPxGridViewBehaviorSettings.AllowFocusedRow property is set to false;
- for a newly created row in Batch Edit mode.
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 (Web Forms) and Grid View - focused Row (MVC) demos.
Web Forms:
<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:
See Also