Hi all,
I'm using an UltraComboEditor as an editor in an UltraWinGrid to make a translation "Internal ID" <-> "User Key". The UltraComboEditor has a DataTabe as the DataSource:
ID Key100 1101 2102 3... ....201 100Entering data:DisplayMember ValueMember 1 -> 1002 -> 101 100 -> 100 WRONG201 -> 201 WRONG
What do I have to do the only Values in the key-list are accepted and correctly translated? DisplayMember ValueMember 1 -> 1002 -> 101 100 -> 201201 -> Not accepted
Hello masch,
A possible approach to achieve this might be by hooking to the 'BeforeCellUpdate' event and do something like the following:
bool isItemInList = false; private void ultraGrid1_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { foreach(ValueListItem item in ultraComboEditor1.Items) { if(item.DisplayText == e.Cell.Text) { isItemInList = true; break; } } if (!isItemInList) { e.Cancel = true; } }
bool isItemInList = false; private void ultraGrid1_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { foreach(ValueListItem item in ultraComboEditor1.Items) { if(item.DisplayText == e.Cell.Text) { isItemInList = true; break; } }
if (!isItemInList) { e.Cancel = true; } }
Please feel free to let me know if I misunderstood you or if you have any other questions.
Hi Boris,
Thank you for your quick reply. Your solution can solve a part of the problem, but only by correcting a wrong behaviour.In the case where I have 1 in the display which means 100 in the value, and I enter 100 I don't get a CellUpdate-Event, because the UltraCombo "thinks" there is already 100 and therefore no data change.
In my opinion there is a general design error: why does the UltraComboEditor look up in the value-members? Even more it looks first in the value-members, and then in the display-members!
Maybe there is a flag which limits the UltraComboEditor to consider only the display-members?
Regards
Manuel
P.S: I'm using V 10.3 and V 11.2