Dynamic binding Listbox - Multiple Selection in Javascript
<p>I have two listboxes, One binds on pageload() and the other binds on button click event.
i have used Javascript for dynamic binding of listboxes on Button click.
On checking a Checkbox, i have to select multiple items that is selected in listbox (pageload()) to the listbox generated on button click.</p>

<p>My Javascript:</p>

<pre><code>function bindingListBox()
{

   var optioncontent = document.getElementById(optionid);

   var lstdata = $("input[id$='hidSelectedItem']").val();

   var eachlstdata = lstdata.split("!@#$");

   for (var j = 0; j &lt; eachlstdata.length; j++)

   {

      var separateeachlstvalue = eachlstdata[j].split(",");

      if(separateeachlstvalue != "")

      {

         optioncontent.value = separateeachlstvalue[0];

         optioncontent.text = separateeachlstvalue[1];

         optioncontent.setAttribute("selected","selected"); 

      } 

   }

}     
</code></pre>

<p>"hidSelectedItem" - hiddenfield contains selected items in first listbox on checkbox check.</p>

<p>The above code selects only the last item on checkbox check.</p>

<p>Can you please help me to populate all the selected items in the ListBox created on button click.</p>
