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

GridControl.AllowRestoreSelectionAndFocusedRow Property

Gets or sets whether to preserve the focused row and selection after sorting, grouping or filtering.

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v21.2.dll

NuGet Packages: DevExpress.Win.Design, DevExpress.Win.Grid

Declaration

[Browsable(true)]
[DefaultValue(DefaultBoolean.Default)]
[DXCategory("Data")]
public DefaultBoolean AllowRestoreSelectionAndFocusedRow { get; set; }

Property Value

Type Default Description
DefaultBoolean Default

A DefaultBoolean enumeration value that specifies whether the focused row and selection are restored after sorting, grouping or filtering.

Available values:

Name Description
True

true. DefaultBoolean.True has a constant value of 0, while the standard true value corresponds to a value of 1. In Visual Basic, do not use implicit conversion of Boolean values to DefaultBoolean, and vice versa, as the conversion may produce incorrect results.

False

false. DefaultBoolean.False has a constant value of 1, while the standard false value corresponds to a value of 0. In Visual Basic, do not use implicit conversion of Boolean values to DefaultBoolean, and vice versa, as the conversion may produce incorrect results.

Default

The default behavior determined by the control’s logic.

Remarks

By default, in Large Data Sources: Server and Instant Feedback Modes, a focused row is not restored after sorting or filtering. This allows you to significantly improve application performance by avoiding additional requests to the server. However, if you need to preserve a focused row, set the AllowRestoreSelectionAndFocusedRow property to true.

If the grid doesn’t operate in server mode, a focused row and selection are automatically restored after sorting, grouping or filtering (by default). To disable this functionality, turn off the AllowRestoreSelectionAndFocusedRow option.

When grouping by a column so that this column becomes the first grouping column (or the single grouping column), the focused row is not restored, regardless of the AllowRestoreSelectionAndFocusedRow option. Focus is always moved to the first visible row. The same applies when completely ungrouping data (when no grouping column is left).

When a selected row becomes hidden (e.g., as a result of a data filtering operation), this row is deselected, and its selection status will not be automatically restored.

See Also