ASPxClientGridView.SetFocusedRowIndex(visibleIndex) Method
Moves focus to the specified row.
Declaration
SetFocusedRowIndex(
visibleIndex: number
): void
Parameters
Name | Type | Description |
---|---|---|
visibleIndex | number | The row index. |
Remarks
Set the AllowFocusedRow property to true
to enable row focus.
Call the SetFocusedRowIndex(visibleiIndex)
method to focus the corresponding row within the current page. When the row focus changes, the server-side ASPxGridView.FocusedRowChanged or the client-side ASPxClientGridView.FocusedRowChanged event fires (based on the ProcessFocusedRowChangedOnServer property value). If you navigate to another page, the row loses focus.
Example
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False"
ClientInstanceName="grid" KeyFieldName="CategoryID">
<SettingsBehavior AllowFocusedRow="true" />
<SettingsDetail ShowDetailRow="True" AllowOnlyOneMasterRowExpanded="true" />
<ClientSideEvents DetailRowExpanding="OnDetailRowExpanding" />
<Columns><%--...--%></Columns>
<Templates>
<DetailRow>
<dx:ASPxGridView ID="ASPxGridView2" runat="server" AutoGenerateColumns="False"
OnBeforePerformDataSelect="ASPxGridView2_BeforePerformDataSelect">
<Columns><%--...--%></Columns>
</dx:ASPxGridView>
</DetailRow>
</Templates>
</dx:ASPxGridView>
function OnDetailRowExpanding(s, e) {
grid.SetFocusedRowIndex(e.visibleIndex);
}
protected void ASPxGridView2_BeforePerformDataSelect(object sender, EventArgs e) {
Session["CategoryID"] = (sender as ASPxGridView).GetMasterRowKeyValue();
}
See Also