title: Copying items from one <asp:ListBox> to another dynamically
body: <p>This is our code: </p>
  
  <pre><code>  &lt;div&gt;
   &lt;table style="width: 349px"&gt;
      &lt;tr&gt;
      &lt;td class="style1"&gt;
          &lt;asp:ListBox ID="leftbox" runat="server" Height="114px" Width="212px" 
              SelectionMode="Multiple" AutoPostBack="True"&gt;
          &lt;/asp:ListBox&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;asp:Button ID="Button1" runat="server" Text="&gt;&gt;" onclick="Button1_Click" /&gt;&lt;br /&gt;
          &lt;asp:Button ID="Button2" runat="server" Text="&lt;&lt;" onclick="Button2_Click" /&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;asp:ListBox ID="rightbox" runat="server" Height="117px" Width="231px" 
              SelectionMode="Multiple" AutoPostBack="True"&gt;&lt;/asp:ListBox&gt;
      &lt;/td&gt;
  
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;    
  </code></pre>
  
  <p>The code behind is:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (!IsPostBack)
      {
          List&lt;string&gt; list= GetNameList();
          leftbox.DataSource = list;
          leftbox.DataBind();             
      }
  }
  
  private static List&lt;string&gt; GetNameList()
  {
      List&lt;string&gt; list = new List&lt;string&gt;();
      list.Add("keerthana");
      list.Add("sirisha");
      list.Add("anusha");
      list.Add("Anuradha");
      list.Add("Bhavani");
      list.Add("divya");
      list.Sort();
      return list;
  }
  </code></pre>
  
  <p>Please tell me how to add two or more selected items one by one from <code>leftbox</code> to <code>rightbox</code>,  without using server-side code (as below):</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {
      if (leftbox.SelectedIndex != -1)
      {
          rightbox.Items.Add(leftbox.SelectedItem.Text);
          leftbox.Items.Remove(leftbox.SelectedItem.Text);
      }
  }
  </code></pre>
  
  <p>Thanks in advance...</p>