I have two lists in asp.net. When I click the button, I want to load the list box with the elements of the selected elements in another field. The problem is that this needs to be done on the client side, because when the button is pressed, I do not allow it to be sent. I want to call the javascript function onselectedindexchange, but this is the server side. any ideas? Should I be more clear?
Decision
enter code here
function Updatelist() {
var sel = document.getElementById('<%=ListBox1.ClientID%>')
var lst2 = document.getElementById('<%=ListBox2.ClientId %>')
var listLength = sel.options.length;
var list2length = lst2.options.length;
for (var i = 0; i < listLength; i++) {
if (sel.options[i].selected) {
lst2.options[list2length] = new Option(sel.options[i].text);
list2length++;
}
}
}
Eric source
share