Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
UltraComboEditor with CheckedItems and ValueMembers within a UltragridCell
posted

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: 100
s_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.CheckBox
Me.cboKStValueList.CheckedListSettings.EditorValueSource = Infragistics.Win.EditorWithComboValueSource.CheckedItems
Me.cboKStValueList.CheckedListSettings.ItemCheckArea = Infragistics.Win.ItemCheckArea.Item
Me.cboKStValueList.CheckedListSettings.ListSeparator = ";"
Me.cboKStValueList.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList

Me.cboKStValueList.DataSource = cls_ZE_global.lstKSt
Me.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

Parents
  • 95
    Offline posted

    Hi,

    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 db
    s_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

Reply Children