javascript - Asp.net listbox used client side -
i have 2 asp.net listbox control in page lbox1 , lbox2 lbox1 filled in code behind . user can select items on lbox1 , clicking on button selected items goes in lbox2. using javascript becouse don't want postback on each click.
this javascript function :
function updatelist() { var sel = document.getelementbyid("lbox1"); var listlength = sel.options.length; (var = 0; < listlength; i++) { if (sel.options[i].selected) document.getelementbyid("lbox2").add(new option(sel.options[i].value)); } }
now need send on server side content of lbox2 using button. think using simple asp button onserverclick event not work becouse in server side lbox2 never filled!
how can ?
you'll need add button , js function copies values lbox1
control <asp:hiddenfield>
control. once post back, selected values available in hidden control's value
property.
Comments
Post a Comment