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.v22.2.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
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.
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).