LookupEdit

The LookupEdit component renders a Dataverse lookup (reference) column, allowing users to search for and select a related record.

<LookupEdit ColumnName="primarycontactid" />

Editor Type

Set EditorType to choose the rendering style: LookupEditType.AutoComplete (default) provides type-ahead search, LookupEditType.Dropdown shows a fixed list, and LookupEditType.RadioButtons displays all options as radio buttons.

<!-- Autocomplete with type-ahead (default) -->
<LookupEdit ColumnName="primarycontactid" EditorType="LookupEditType.AutoComplete" />

<!-- Dropdown with fixed list -->
<LookupEdit ColumnName="primarycontactid" EditorType="LookupEditType.Dropdown" />

<!-- Radio buttons -->
<LookupEdit ColumnName="primarycontactid"
            EditorType="LookupEditType.RadioButtons"
            RadioButtonOrientation="ComponentOrientation.Vertical" />

Views

Use ViewIds to constrain which views are available in the advanced search dialog. Use DefaultViewId to set which view is used for searching. The ViewIds parameter is a Dictionary<string, List<Guid>> keyed by table name, supporting polymorphic lookups that target multiple tables.

<LookupEdit ColumnName="primarycontactid"
            ViewIds="_contactViews"
            DefaultViewId="@(new Guid("..."))" />

@code {
    private Dictionary<string, List<Guid>> _contactViews = new()
    {
        { "contact", new List<Guid> { new Guid("...") } }
    };
}

Polymorphic Lookups

For lookup columns that target multiple tables, use DefaultTable to set which table is selected by default in the table selector.

<LookupEdit ColumnName="parentcustomerid" DefaultTable="account" />

LookupEdit

Here is an example that demonstrates the use of a LookupEdit component.

Example

LookupEdit (Extended Properties)

This demonstrates the most common properties that are availabe to set on the LookupEdit.

Example
Readonly? Required? Disabled? ContactAccount AutoCompleteDropdownRadio Buttons

LookupEdit Class

Parameters

Name
Type
Default
Description
ChildContentRenderFragment?
Child content of the component
ColumnNamestring
Column logical name to bind the editor to from the table record.
DefaultTablestring?
Optionally specify which table should be set as the default table to search when the lookup is
linked to a customer or polymorphic column type.
DefaultViewIdGuid?
Specify which view should be used for searching, otherwise the Lookup view will be used.
Descriptionstring?
Description to be displayed in the tooltip.
Disabledbool?
Should the editor be disabled.
DisplayLabelWhenAvailablebool
True
Specifies whether to display a lable if available.
DisplayNullChoicebool
True
Only applicable when the == RadioButtons.
Displays a radio button that represents a NULL value.
DisplayTooltipWhenAvailablebool
True
Specifies whether to display a tooltip if available.
DisplayValidationErrorMessagebool
True
Should a validation error message be displayed when the component fails validation?
EditorTypeLookupEditType
AutoComplete
Type of editor to render for selecting values.
IsVisiblebool
True
Is the editor visible.
Labelstring?
Text to be displayed as a label for the editor.
MaxRecordsReturnedint
20
That maximum number of records to return when querying Dataverse. This also limits the records displayed when the
is equal to or .
RadioButtonOrientationComponentOrientation
Vertical
Orientation of the radio buttons. Only valid when the is set to .
ReadOnlybool?
Should the editor be read-only.
Requiredbool?
Should the value be required.
ValueLookupEditValue?
Gets or sets the editor's currently selected lookup record.
ViewIdsDictionary<string, List<Guid>>?
Optionally constrain which views can be displayed in the 'Advanced Search' dialog.
The key in the dictionary is the table name.
Name: ChildContent
Type: RenderFragment?
Description: Child content of the component
Name: ColumnName
Type: string
Description: Column logical name to bind the editor to from the table record.
Name: DefaultTable
Type: string?
Description: Optionally specify which table should be set as the default table to search when the lookup is
linked to a customer or polymorphic column type.
Name: DefaultViewId
Type: Guid?
Description: Specify which view should be used for searching, otherwise the Lookup view will be used.
Name: Description
Type: string?
Description: Description to be displayed in the tooltip.
Name: Disabled
Type: bool?
Description: Should the editor be disabled.
Name: DisplayLabelWhenAvailable
Type: bool
Default: True
Description: Specifies whether to display a lable if available.
Name: DisplayNullChoice
Type: bool
Default: True
Description: Only applicable when the == RadioButtons.
Displays a radio button that represents a NULL value.
Name: DisplayTooltipWhenAvailable
Type: bool
Default: True
Description: Specifies whether to display a tooltip if available.
Name: DisplayValidationErrorMessage
Type: bool
Default: True
Description: Should a validation error message be displayed when the component fails validation?
Name: EditorType
Type: LookupEditType
Default: AutoComplete
Description: Type of editor to render for selecting values.
Name: IsVisible
Type: bool
Default: True
Description: Is the editor visible.
Name: Label
Type: string?
Description: Text to be displayed as a label for the editor.
Name: MaxRecordsReturned
Type: int
Default: 20
Description: That maximum number of records to return when querying Dataverse. This also limits the records displayed when the
is equal to or .
Name: RadioButtonOrientation
Type: ComponentOrientation
Default: Vertical
Description: Orientation of the radio buttons. Only valid when the is set to .
Name: ReadOnly
Type: bool?
Description: Should the editor be read-only.
Name: Required
Type: bool?
Description: Should the value be required.
Name: Value
Type: LookupEditValue?
Description: Gets or sets the editor's currently selected lookup record.
Name: ViewIds
Type: Dictionary<string, List<Guid>>?
Description: Optionally constrain which views can be displayed in the 'Advanced Search' dialog.
The key in the dictionary is the table name.

Events

Name
Type
Description
ValueChangedEventCallback<ColumnValueBase>
Gets or sets a callback that updates the bound value.
Name: ValueChanged
Type: EventCallback<ColumnValueBase>
Description: Gets or sets a callback that updates the bound value.

Methods

Name
Parameters
Type
Description
GetValidationErrorsList<string>
Returns a collection of the current validation errors.
Name: GetValidationErrors
Type: List<string>
Description: Returns a collection of the current validation errors.