Populating DropDownList via script


Is there a way to populate the DropDownlist control via script? I’ve tried to push items to the dropDownList.items, however, the control is not reflecting the newly added items.



1 Like

What are you doing? We do something like this, pushing a value and caption and value for each item in an array into an array which we then swap into the dropdown list.

There are simpler ways, but this what I have to hand now

var items = [];
for (index = 0; index < array.length; index++) {
var item = new dundas.controls.DropDownListItem({
“value”: array[index],
“caption”: array[index]

dropDownList1.items = items;

Yes, I’m doing something like that. It didn’t occur to me to replace the itemList instead of pushing it directly to there. I’ll try this out.

I’ve managed to make it work! Thank you, David. :slight_smile: