M
Mario Vargas
Hello all,
I am trying to dynamically add elements to a select list (which is running
on the server, runat="server") with JavaScript, but when I postback, the new
elements are lost. I'm not sure how to tell ASP.Net to post back these new
elements as well. Any ideas or sources where you could point me to will be
greatly appreciated. I am still using ASP.Net 1.1.
This is part of the code I am using to dynamically add the element:
myOpenerListCtrl.options[myOpenerListCtrl.options.length] = new Option(
districtName, districtID );
I also tried using standard DOM syntax:
var newOption = document.createElement( "option" );
newOption.setAttribute( "value", districtID );
newOption.innerText = districtName;
myOpenerListCtrl.appendChild( newOption )
But neither is kept in the postback.
Thanks!
Mario
I am trying to dynamically add elements to a select list (which is running
on the server, runat="server") with JavaScript, but when I postback, the new
elements are lost. I'm not sure how to tell ASP.Net to post back these new
elements as well. Any ideas or sources where you could point me to will be
greatly appreciated. I am still using ASP.Net 1.1.
This is part of the code I am using to dynamically add the element:
myOpenerListCtrl.options[myOpenerListCtrl.options.length] = new Option(
districtName, districtID );
I also tried using standard DOM syntax:
var newOption = document.createElement( "option" );
newOption.setAttribute( "value", districtID );
newOption.innerText = districtName;
myOpenerListCtrl.appendChild( newOption )
But neither is kept in the postback.
Thanks!
Mario