Preset Value on Infragistics UltraCombo
-
20-08-2019 - |
Question
I have an infragistics ultraCombo
that I set to a specific datasource
. I want to pre-select one of those values so the user doesn't have to choose it (most of the time it will be the pre-selected value). However, when I set the ultraCombo
to that value it modifies the drop-down list to contain only that single value!
I've tried using the ultraCombo.value
method, the ultraCombo.textbox.text
method, etc, and they all behave the same way. When I look in the debugger the full list appears to be present, just not displayed. How do I pre-select a value in the list without destroying my drop-down list?
Solution
Finally got it to work using the following code:
Dim tempValue As String = myPreviousValue 'changes to the object loose the selected row--save it off and restore later
MyUltraCombo.DataSource = queryDS.Tables(0) 'load the new data
'Restore the previous selection
If tempValue <> "" Then
For Each row As Infragistics.Win.UltraWinGrid.UltraGridRow In MyUltraCombo.Rows
If row.Cells(0).Value.ToString = tempValue Then
MyUltraCombo.SelectedRow = row
End If
Next
End If
OTHER TIPS
During databind, wouldn't you just use whatever Infragistics's method is for getting/setting the selected value/index
i.e. ultracombo.selectedvalue = "My Value"
or ultracombo.selectedindex = 1
Edit: I did a little google searching and found a topic on their support forum of what appears to be someone asking near the same thing. They are saying there that to select an answer you would just set the .Value property, so I am imagining it might be something along the lines of ultracombo.value = 1
Here is the link for more the full support thread.
This is how you set the value of Infragistics ComboBox
:
ultracombo.value=1