This example handles the Properties.CustomDisplayText event to display custom text if the lookup's EditValue
does not match any value in the drop-down list (the value does not exist in the data source).
const string NotFoundText = "???";
private void RepositoryItemLookUpEdit_CustomDisplayText(object sender, CustomDisplayTextEventArgs e) {
RepositoryItemLookUpEdit props;
if(sender is LookUpEdit)
props = (sender as LookUpEdit).Properties;
else
props = sender as RepositoryItemLookUpEdit;
if(props != null && (e.Value is int)) {
object row = props.GetDataSourceRowByKeyValue(e.Value);
if(row == null) {
e.DisplayText = NotFoundText;
}
}
}
- DevExpress WinForms Troubleshooting - LookUp Editors
- How to Determine if a Value Put into the LookupEdit Does Not Exist in the Data Source
- How to Use the ProcessNewValue Event of a LookUp Editor
(you will be redirected to DevExpress.com to submit your response)