Skip to main content

ASPxGridViewBehaviorSettings.AllowFocusedRow Property

Specifies whether row focus is enabled.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v22.2.dll

NuGet Package: DevExpress.Web


public bool AllowFocusedRow { get; set; }

Property Value

Type Default Description
Boolean false

true to enable row focus; otherwise, false.

Property Paths

You can access this nested property as listed below:

Object Type Path to AllowFocusedRow
.SettingsBehavior .AllowFocusedRow
.SettingsBehavior .AllowFocusedRow


Set the AllowFocusRow property to true to enable row focus. When the focus changes, the control raises the server ASPxGridView.FocusedRowChanged or the client ASPxClientGridView.FocusedRowChanged event (based on the ProcessFocusedRowChangedOnServer property value) and sets the FocusedRowIndex property to the index of the focused row.

The control can focus only one row at a time within the current page. If you navigate to another page, the row loses focus. To select multiple rows within different pages, use row selection.

When row focus is disabled, the control behaves as follows:

  • The FocusedRowIndex property returns -1.
  • The FocusedRowChanged event does not fire.
  • Focused row style settings are not in effect.

To identify the row being edited, use the EditingRowVisibleIndex property.


Web Forms Example

The examples below show how to use the AllowFocusedRow property.

View Example: ASPxGridView - How to focus a master row when a user clicks the Expand Detail Row icon

View Example: ASPxGridView - How to save a focused row index to cookies on the server side

<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False"
    ClientInstanceName="grid" KeyFieldName="CategoryID">
    <SettingsBehavior AllowFocusedRow="true" />
    <SettingsDetail ShowDetailRow="True" AllowOnlyOneMasterRowExpanded="true" />
    <ClientSideEvents DetailRowExpanding="OnDetailRowExpanding" />
            <dx:ASPxGridView ID="ASPxGridView2" runat="server" KeyFieldName="ProductID"
function OnDetailRowExpanding(s, e) {

MVC Example

@Html.DevExpress().GridView(settings => {
    settings.Name = "GridView";
    settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewPartial" };
    settings.SettingsPager.PageSize = 5;

    settings.KeyFieldName = "EmployeeID";

    settings.PreRender = (s, e) => {
        var sender = (MVCxGridView)s;
        // Set the zero-based index of the focused row. 
        sender.FocusedRowIndex = 6;
    // Enable row focus. 
    settings.SettingsBehavior.AllowFocusedRow = true;
See Also