Hi,
I recognized a strange behaviour in one of my ultragrids.
When using the combination of one ultracombo as a valuelist and a second one as editorcomponent for one of my columns, all values are displayed correctly. My columns show the "texts" instead of the IDs. So the valuelist is working well.
Clicking one of the columns cells causes a strange behaviour. The cellvalue and so the text switches immediatly to something different. It seems to me, that it changes to the valuelist index instead of using my key to determine the value.
If the editorcomponent would'nt contain my old value, I could understand this, because of the missing relation, but why does it always change?
Here's a piece of code, that explains my thoughts.
Imports Infragistics.WinImports Infragistics.Win.UltraWinGridPublic Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dtGrid As New DataTable dtGrid.Columns.Add("Value") dtGrid.Rows.Add(1) dtGrid.Rows.Add(2) dtGrid.Rows.Add(3) dtGrid.Rows.Add(4) UltraGrid1.DataSource = dtGrid Dim dtValues As New DataTable dtValues.Columns.Add("Key") dtValues.Columns.Add("Text") dtValues.Rows.Add(1, "A") dtValues.Rows.Add(2, "B") dtValues.Rows.Add(3, "C") dtValues.Rows.Add(4, "D") dtValues.Rows.Add(5, "E") dtValues.Rows.Add(6, "F") dtValues.Rows.Add(7, "G") UltraComboValue.DataSource = dtValues Dim dtEdit As New DataTable dtEdit.Columns.Add("Key") dtEdit.Columns.Add("Text") dtEdit.Rows.Add(1, "A") dtEdit.Rows.Add(3, "C") dtEdit.Rows.Add(5, "E") dtEdit.Rows.Add(7, "G") UltraComboEdit.DataSource = dtEdit UltraComboEdit.ValueMember = "Key" UltraComboValue.ValueMember = "Key" UltraComboEdit.DisplayMember = "Text" UltraComboValue.DisplayMember = "Text" SpalteAlsDropDownMitContaisVorschlag(UltraGrid1.DisplayLayout.Bands(0).Columns(0), UltraComboEdit, UltraComboValue) End Sub Public Shared Sub SpalteAlsDropDownMitContaisVorschlag(ByVal Spalte As UltraGridColumn, _ ByVal EditCombo As UltraCombo, _ ByVal ValueListe As UltraCombo) With Spalte With EditCombo .DropDownStyle = UltraComboStyle.DropDown .AutoCompleteMode = AutoCompleteMode.SuggestAppend .AutoSuggestFilterMode = AutoSuggestFilterMode.Contains End With .EditorComponent = EditCombo .ValueList = ValueListe .AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend .AutoSuggestFilterMode = AutoSuggestFilterMode.Contains .Style = ColumnStyle.DropDownValidate .InvalidValueBehavior = InvalidValueBehavior.RetainValueAndFocus End With End SubEnd Class
I hope you can help me understanding what happens here and how I can get the correct values when clicking a cell.
Thanks in advance
It does not make sense to set the EditorComponent on a column to one UltraCombo and the ValueList to a different UltraCombo.
Perhaps if you explain what you are trying to achieve here, I might be able to suggest a better way to do it.
Having said that, the behavior you are getting here is a bit odd. I think this is probably happening because of an optimization where the grid caches the index of the selected item on the list. When it goes into edit mode, the editor is picking up the item at that index instead of the item that matches the value.
This may be a bug in the grid, but since I would be very hesitant to change any of this behavior in the grid, since what you are doing here is rather bizarre and there's a good chance that "fixing" this might cause other issues.
to say it in short words: I try to show the translation of an ID into text for all data but avoid selection of entrys that are not allowed if you edit the data.
Let me try to explain it by example:
In one column of a table we save the ID of an employee. This is the person you can ask if you have questions about the data in this line. In the grid we translate via value-list the ID into the name of the employee.
At 05.01.2011 we put an new line in and choose "Mr. Müller" as the spezialist. At that timt Mr. Müller was an active employee.
At 01.02.2011 Mr. Müller leave the company. From this time he is not longer an active employee.
If I open today (27.05.2011) the grid I want to see his name (and not the ID) in the grid in the data from 05.01.2011 (via value-list). But it is not allowed to choose Mr. Müller for anny entry now.
So I create a list of active employee (without Müller) and use this as edit-list.
I hope you understand now what I try to do.
I`d like to inform you, that I already create a case with referance number CAS-65962-HXL0MP.
Please note that you can continue to write here or though the case.
Regards