Skip to main content

RepositoryItemLookUpEditBase.KeyMember Property

Gets or sets a string that specifies a key field (or multiple key fields) used for business object identification (when a lookup editor is bound to a business object).

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultValue("")]
[DXCategory("Data")]
public virtual string KeyMember { get; set; }

Property Value

Type Default Description
String String.Empty

A string that specifies a key field or multiple key fields delimited by the ‘;’ character.

Remarks

When a lookup editor is bound to a business object (not to a value of a simple type), you must assign the business object’s key field to the KeyMember property to allow for proper business object identification.

If a business object has multiple key fields, specify all these key field names in the KeyMember property value, by delimiting them with the ‘;’ character. For instance:

lookUpEdit1.Properties.KeyMember = "OrderID;ProductID";

At design time, you can set the KeyMember property in the Properties window using a dedicated editor, which shows all available fields from the bound lookup data source.

lookupEdit-KeyMemberProperty-DesignTimeEditor

When an end-user selects a certain lookup record in the dropdown, this record (the object that encapsulates this record) is assigned to the lookup editor’s edit value. Ensure that the data type of lookup records is accepted by the editor’s edit value.

For more information and an example, see Advanced Binding (to Business Objects).

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the KeyMember property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also