B
bill
I need to be able to dynamically add items to a <asp:listbox> (or HTML
<select runat=server>) using clientside javascript, and retrieve the items
when the page is posted back.
I use this code to add the option to the listbox. It works for <select> or
<asp:listbox> controls.
var opt = document.CreateElement("OPTION");
opt.text = "test";
opt.value="test";
window.document.getElementByID("listName").options.add(opt);
I have no problem adding the items to the listbox, but they are not posted
to the server on postback.
When the page posts back, the listbox control has no items.
Is there something I can do to make these added items accessible when the
page posts back?
Thanks
Bill
<select runat=server>) using clientside javascript, and retrieve the items
when the page is posted back.
I use this code to add the option to the listbox. It works for <select> or
<asp:listbox> controls.
var opt = document.CreateElement("OPTION");
opt.text = "test";
opt.value="test";
window.document.getElementByID("listName").options.add(opt);
I have no problem adding the items to the listbox, but they are not posted
to the server on postback.
When the page posts back, the listbox control has no items.
Is there something I can do to make these added items accessible when the
page posts back?
Thanks
Bill