My usual method of populating a Dropdown with JavaScript involves the following code:
function populateDropdown(ddl_id) {
var option_str = "";
var x;
for(x in dataList){
option_str += " <asp:ListItem Value='" + dataList[x] + "' Text='" + dataList[x] + "'></asp:ListItem>"
}
var dropdownDiv = document.getElementById(ddl_id);
dropdownDiv.innerHTML = option_str;
}
Although the datalist is not empty and the Dropdown list is populated perfectly, I am facing an issue where the selected value is not being retrieved after clicking on the add button on my page.
Any ideas or suggestions would be greatly appreciated. Thank you!