[SOLVED] ComboBox Text set from code

Answered Closed
0
0

Hi,

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.

Best,
Alex

  • You must to post comments
Best Answer
0
0

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:

this.getChildControl("textfield").setReadOnly(true);

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.

Best,

Luca

 

 

  • You must to post comments
0
0

Hi Alex,

the readonly property for ComboBoxes is now available with build 1.3.15.

Best regards
Frank

  • You must to post comments
0
0

I have logged WJ-7833 for that enhancement.

Best regards
Frank

  • You must to post comments
0
0

I suppose you mean to call

this.Eval(“this.getChildControl(\”textfield\”).setReadOnly(true);”);

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.

Best,
Alex

  • Luca (ITG)
    Great. We’ll add a ReadOnly property to ComboBox.
  • You must to post comments
0
0

Hi Luca,

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.

Best,
Alex

  • You must to post comments
0
0

Hi Alex,

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.

Ciao,

Luca

 

  • You must to post comments
Showing 6 results