Hi,
i am using a Ultragrid - in one Column a UltraComboEditor is used as EditorComponent.The UltraComboEditor is set for multiple selection with checkboxes.
The Problem: the result of the ultracomboeditor is always the DisplayTEXT not the selected VALUES (IDs)
Example of the Content of the List:ID: 100s_Bezeichnung: "Kostenstelle 1"
wrong result: "KostenstelleA; KostenstelleB; KostenstelleC" right result: "100;200;300"
In the Database should be saved the IDs of the CheckedItems: 100;200;300
Definition of the UltraComboEditor:
Me.cboKStValueList.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBoxMe.cboKStValueList.CheckedListSettings.EditorValueSource = Infragistics.Win.EditorWithComboValueSource.CheckedItemsMe.cboKStValueList.CheckedListSettings.ItemCheckArea = Infragistics.Win.ItemCheckArea.ItemMe.cboKStValueList.CheckedListSettings.ListSeparator = ";"Me.cboKStValueList.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList
Me.cboKStValueList.DataSource = cls_ZE_global.lstKStMe.cboKStValueList.DisplayMember = "s_Bezeichnung"Me.cboKStValueList.ValueMember = "ID"
Setting the UltraComboEditor as EditorComponent
For Each col As Infragistics.Win.UltraWinGrid.UltraGridColumn In ugResult.DisplayLayout.Bands(0).Columns Select Case col.Key case "s_KSt" col.EditorComponent = cboKStValueList...
Thanks for your help!
Mike Fleisch
i found a dirty solution on my own - but would be glad, if there is a better way
I am using to strings for this
s_KSt_MultiSel ... contains the IDs, read and save from dbs_KSt_MultiSel_Display ... contains the translated Display-Values
After the cell has changed, the original IDs are set manually
Private Sub ugZulagenJeTag_AfterCellUpdate(sender As Object, e As CellEventArgs) Handles ugZulagenJeTag.AfterCellUpdate Try If e.Cell.Column.Key = "" Then Dim cls As cls_ZE_ZulagenJeTag = e.Cell.Row.ListObject If cls IsNot Nothing AndAlso Me.ugZulagenJeTag.Rows(0).Cells("s_KSt_MultiSel_Display").EditorComponentResolved IsNot Nothing Then cls.s_KSt_MultiSel = "" For Each itm As ValueListItem In DirectCast(Me.ugZulagenJeTag.Rows(0).Cells("s_KSt_MultiSel_Display").EditorComponentResolved, UltraComboEditor).CheckedItems cls.s_KSt_MultiSel &= itm.DataValue & ";" Next End If End If Catch ex As Exception Dim errhandler As New ErrorHandler errhandler.HandleError(ex) End Try End Sub
Greets, Mike
The valuelist of the combo has a ValueDisplayStyle that you can set to DataValue.
eg.
(ultraComboEditor1.ValueList as Infragistics.Win.ValueList ).DisplayStyle = ValueListDisplayStyle.DataValue;
Hi Michael,
thx for your answer, but i am sorry, thats not the resolution.
Setting the DisplayStyle to "DataValue" means, that the user sees the values, too.
I need the (Display)Text for the user and the (Data)Value for the code.
Hi Mike,
Do you want to be able to list values in the dropdown but display something different in the editor when the user checks them? They normally are supposed to be the same text as users select. The combo is designed to map a single property to the display member or value member.
It would be a new product idea to add a separate DisplayMember property to the edit portion of the combo while displaying something else in the checkbox selection dropdown. Also a new "DisplayTextAndDataValue" enum to the ValueListDisplayStyle could be something we add too if you wanted to combine the two in either spots. For now I would create a new property that is a combination of two properties you want to display to the user and map that to your DisplayMember path of the combo.
public string FullName get { return this.lastName + "," + this.firstName; }
You can suggest new product ideas for future versions (or vote for existing ones) at <https://www.infragistics.com/community/ideas>.
Let me know if you have any questions.
i don't think that this is something new or anything who nobody needs.I just wand to bind a key/value-list.
The EditorComponent can handle this with a single-selection.Therefore you use the "DisplayMember" and "ValueMember".
Only if you want to use multi-selection this issue occurs.
I think, this should be a default function ....