All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

GridLookUpEdit.AutoSearchComplete Event

Fires when a search in AutoSearch mode completes.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraGrid.v21.1.dll

Declaration

[DXCategory("Events")]
public event LookUpEditAutoSearchCompleteEventHandler AutoSearchComplete

Event Data

The AutoSearchComplete event's data class is DevExpress.XtraEditors.Controls.LookUpEditAutoSearchCompleteEventArgs.

Remarks

If the GridLookUpEdit.Properties.SearchMode property is set to AutoSearch, the editor automatically filters data source records in the drop-down window when the user enters a query in the edit box. The AutoSearch event fires before the data records are filtered and allows you to customize filter settings. The AutoSearchComplete event fires after the data records are filtered and allows you to perform custom actions. For example, you can automatically select a row or adjust the drop-down window height.

The GridLookUpEdit.AutoSearchComplete event is equivalent to the GridLookUpEdit.Properties.AutoSearchComplete event.

Example

In AutoSearch mode, the editor does not automatically select the first row that fits the entered query. If the search results contain only one row, you can handle the GridLookUpEdit.AutoSearchComplete event to automatically select this row as the code below demonstrates.

using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;

private void GridLookUpEdit1_AutoSearchComplete(object sender, DevExpress.XtraEditors.Controls.LookUpEditAutoSearchCompleteEventArgs e) {
    GridLookUpEdit edit = sender as GridLookUpEdit;
    GridView view = edit.Properties.View;
    if (view.RowCount == 1) {
        view.FocusedRowHandle = 0;
        gridLookUpEdit1.EditValue = view.GetFocusedRowCellValue(gridLookUpEdit1.Properties.ValueMember);
        gridLookUpEdit1.ClosePopup();
    }
}
See Also