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

SearchLookUpEdit Class

The editor that provides lookup functionality using a dropdown feature-rich data grid (GridControl), and contains the built-in Find Panel, allowing end-users to quickly filter and locate dropdown records. You can display lookup records in a tabular format, banded tabular format, or as tiles (which can be arranged in one or multiple columns/rows, rendered as a list or a Kanban board).

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraGrid.v20.2.dll

NuGet Package: DevExpress.Win.Grid

Declaration

public class SearchLookUpEdit :
    GridLookUpEditBase

The following members return SearchLookUpEdit objects:

Remarks

A lookup editor is an editor with an embedded dropdown window which displays lookup records (the records from which an end-user can select). When a lookup record is selected, the editor’s value (the BaseEdit.EditValue bindable property) and display text are modified accordingly.

The SearchLookUpEdit supports a built-in Find Panel, which allows an end-user to quickly locate rows by the text they contain.

The SearchLookUpEdit can display lookup records in the dropdown using multiple data presentation formats (Views), which you can choose with the RepositoryItemGridLookUpEditBase.PopupViewType property:

  • Grid View (default) - Displays data in a tabular form. The following features, and many more, can be employed for the Grid View embedded in the SearchLookUpEdit: data sorting, grouping, filtering, summaries, hiding column headers, changing row height, etc. See Grid View to learn more.

    SearchLookUpEdit_withfilter

  • Tile View - Displays records as read-only tiles, using one of the following layout modes: default (standard table layout), list (tiles have no space between them), and Kanban. This View includes the Tile Template feature, which helps you arrange fields relative to other fields, specify absolute or relative field display bounds, etc. See Tile View.

    SearchLookUpEdit-TileView

  • Banded Grid View - Displays data in a tabular form and allows grouping of columns into bands. See Banded Grid Views.

    SearchLookUpEdit-BandedView.png

  • Advanced Banded Grid View - Displays data in a tabular form, allows grouping columns into bands and supports complex data cell arrangements. See Banded Grid Views.

    SearchLookUpEdit-AdvBandedView.png

After you have set the RepositoryItemGridLookUpEditBase.PopupViewType property, the SearchLookUpEdit control creates a corresponding View object. This View can now be accessed and customized from the RepositoryItemGridLookUpEditBase.PopupView property. At design time, you can customize the View with the Data Grid Designer, which you can open by clicking the ellipsis button for the PopupView property in Properties grid, or by invoking the Design View command (from the Properties window or the control’s smart tag).

SearchLookUpEdit-Designer.png

Note

You can use the Grid Control and View’s methods only when the drop-down window is open if you want to access the data source and calculated data. To access the View, handle the QueryPopUp or Popup event.

private void gridLookUpEdit1_Properties_QueryPopUp(object sender, CancelEventArgs e) {
   GridLookUpEdit gridLookUpEdit = sender as GridLookUpEdit;
   gridLookUpEdit.Properties.PopupView.Columns["ID"].Visible = false;
}

When the drop-down window is closed, use the data source’s methods.

If you customize the View in an event, do not use objects to identify the View, columns, and so on - use field names, captions, etc. instead. The example below shows how to identify a column in a CustomDrawCell event handler.

private void SearchLookUpEdit1View_CustomDrawCell(object sender, >DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) {
   if (e.Column.FieldName == "MyFieldName") {
       //...
   }
}

To learn how to set up lookup editors in different binding modes, see the following topics:

You may want to filter the popup data source of one (secondary) lookup editor based on a value of another (primary) lookup editor. This scenario is covered in the following topic:

The SearchLookUpEdit and GridLookUpEdit controls have many features in common. These controls are identically created and customized (except for the additional features that are only typical to the SearchLookUpEdit control). Please refer to the GridLookUpEdit topic for an example.

Additional Customization

The following list shows some of the members that help you perform the additional customization of the SearchLookUpEdit control.

Search Settings

There are two search modes - automatic and manual. In automatic search mode, a search starts following a small delay after an end-user has stopped typing text. In manual search mode, a search is started manually by pressing ENTER or clicking the Find button.

Automatic search mode is in effect in the following cases:

Manual search mode is in effect in the following cases:

The RepositoryItemGridLookUpEditBase.PopupFilterMode property specifies how dropdown rows are filtered - using the Contains or StartsWith filter. By default, this property is set to PopupFilterMode.Default, which is equivalent to the Contains filter.

The PopupFilterMode property also affects columns against which data is searched. See the PopupFilterMode topic to learn more.

To embed a SearchLookUpEdit in a cell within a container control (XtraGrid, XtraTreeList, etc), use the RepositoryItemSearchLookUpEdit component. See Repository items for more information.

Note

The SearchLookUpEdit clears the active filter after closing the dropdown window.

Note

Instant Feedback Mode is supported by the SearchLookUpEdit when the control is used as a standalone control and when the control is used as an in-place editor within a Grid Control.

Note

You can use the Grid Control and View’s methods only when the drop-down window is open if you want to access the data source and calculated data. To access the View, handle the QueryPopUp or Popup event.

private void gridLookUpEdit1_Properties_QueryPopUp(object sender, CancelEventArgs e) {
   GridLookUpEdit gridLookUpEdit = sender as GridLookUpEdit;
   gridLookUpEdit.Properties.PopupView.Columns["ID"].Visible = false;
}

When the drop-down window is closed, use the data source’s methods.

If you customize the View in an event, do not use objects to identify the View, columns, and so on - use field names, captions, etc. instead. The example below shows how to identify a column in a CustomDrawCell event handler.

private void SearchLookUpEdit1View_CustomDrawCell(object sender, >DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) {
   if (e.Column.FieldName == "MyFieldName") {
       //...
   }
}
See Also