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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -