I’m trying to set the combobox text from code (for a custom combobox I’m creating) but this is only possible if the Mode is DropDown. For DropDownList, the combobox shows empty.
We have the ComboBox.ReadOnly property on a subclass in our gupta migration framework. Can add it to Wisej as well. As a workaround and/or a test you can call the following js on the combobox:
In the combobox widget when the style is ComboBoxList we hide the inner textbox and show an html label instead in order to be able to display rich html items also in the combobox body.
the readonly property for ComboBoxes is now available with build 1.3.15.
I have logged WJ-7833 for that enhancement.
I suppose you mean to call
At least this is what I did and it works beautifully! Thanks for that! It’s incredible how flexible Wisej is!
Before seeing your answer, I tried to reset the ComboBox datasource to just one item, the one I wanted to show in the textbox (so that it would be in the list and DropDownList mode would let me select it as this.Text). However, I got into a loop since I was resetting the datasource, which also changes the ListBox items etc.
The ReadOnly property is I believe the right approach, but at the moment I’m happy with your workaround.
Yes, I understand that… However, I am looking for a combobox where the text is not one of the dropdown list values and at the same time the user cannot edit the text … that’s why I was trying the DropDownList option where the user cannot edit. What I am really looking for is a kind of ReadOnly property.
When the style is DropDownList the text you assign to ComboBox.Text must match one of the values in the list. Only DropDown allows to have an editable combobox with a text value that is not present in the list and a SelectedIndex = -1.