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

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.v19.2.dll

Declaration

[DXCategory("Data")]
[DefaultValue("")]
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).

See Also