title: listbox and javascript to add items
body: <p>I've 2 asp listbox controls and an html input button, and using js i add items (previously loaded from DB) from listbox A to  B and it works fine, but when i submit the form, in the code behind the listbox B do not have the item i added accessible.</p>
  
  <p>My idea was trying to save roundtrips to the server and make it in client side but looks like it doesn't work.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks you very much for you time!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>There's the code</p>
  
  <pre><code>&lt;asp:ListBox ID="lstBoxOrgs" runat="server" Height="117px"  Width="502px" SelectionMode="Multiple"&gt;&lt;/asp:ListBox&gt;
  &lt;input type="button" value="Add" onclick="AddItems2Listbox('lstBoxOrgs', 'lstBoxUserRelOrgs') "/&gt;
  </code></pre>
  
  <p>Code behind:</p>
  
  <pre><code>protected void AssignOrgs_Click(object sender, EventArgs e)
  {
      foreach (ListItem orgItem in lstBoxUserRelOrgs.Items)
      {
          //Update database here...
      }
  
      //Commit updates to DB
      cdc.SubmitChanges();
  }
  </code></pre>
  
  <p>The <code>onclick="AddItems2Listbox('lstBoxOrgs', 'lstBoxUserRelOrgs')</code>  is the javascript function that adds the items from lisbox A to listbox B.</p>
  
  <p>Thanks</p>