Hi There,
ASP.NET postback scenario trying to maintain state of dynamic combobox. I am assuming that I must do the following:
- Use Onchange method
- store in hidden inputs the selected value and text
- each postback set the combobox values and text according to the hidden inputs.
- here I am assuming not only do I need to set the text and value of the box but also add 1 entry to the list for the dropdown part? Or does that happen automatically when setSelectedText/Value is used?
I could of sworn somewhere I read that before you postback (unloading of the page) you need to make sure the combobox values have been updated? Or was that just for the select tag scenario?
Can’t find that posting now… Is there anything else required by the combo box?
Thanks, Angela
Hi,
the selected value (not text) is put in the hidden input that is created automatically. The name of the input is the same as the second parameter in dhtmlxCombo constructor. Also there is the other hidden input which name is combo name +"_new". Its values can be only true or false and it indicates wherether the value is choosen from option list or it is a new value that is typed by user.
Please see samples:
dhtmlxCombo/samples/02_actions/03_combo_save.html
dhtmlx.com/docs/products/dht … _save.html
Combo value can be got by combo.getActualValue() method. The text in combo header - combo.getComboText();
Hi Alexandra,
When using the debugger for javascript… I am not finding a name_new object.
So, my test case is inserting debugger into a onchange event. So I can check values.
I check my combobox.name which is “ctl00_body_divLocations”
The combobox is there, an object.
When I do a watch on “ctl00_body_divLocations_new” it tells me it is undefined.
Just in case I went through and downloaded the latest JS in case it was a recent addition.
The link you sent me to… Doesn’t show the _new functionality that you mentioned.
But it does show the “confirmvalues” that I remembered seeing.
Your help is greatly appreciated,
Angela
I figured it out… it is really “_new_value” through looking at the combobox property DOMelem_hidden_input2.name property…
Later