how to add multiple selected values from one listbox to a second asp.net listbox
<p>I have two list boxes that I am trying to pass multiple values from one to the other.
asp.net code</p>

<pre><code>&lt;asp:UpdatePanel ID="userButtonPanel" runat="server" UpdateMode="Conditional"&gt;
                                &lt;ContentTemplate&gt;
                                    &lt;asp:LinkButton Text="&gt;&gt;" ID="lbtn_add" CssClass="button advButtons addRemButton"
                                        runat="server" OnClick="addMappedUser_Click" /&gt;
                                    &lt;asp:LinkButton Text="&lt;&lt;" ID="lbtn_remove" CssClass="button advButtons addRemButton"
                                        runat="server" OnClick="removeMappedUser_Click" /&gt;
                                &lt;/ContentTemplate&gt;
                            &lt;/asp:UpdatePanel&gt;
                        &lt;/div&gt;
                        &lt;div&gt;
                            &lt;asp:Label ID="lbl_MappedUSers" Text="Mapped Users" runat="server" /&gt;
                            &lt;asp:ListBox ID="listMappedUsers" runat="server" SelectionMode="Multiple" CssClass="listboxMappedUsers"  /&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
                &lt;input id="cbUserList" type="hidden" runat="server" value="" /&gt;
                &lt;input id="cbUserRoleID" type="hidden" runat="server" value="" /&gt;
            &lt;/ContentTemplate&gt;
        &lt;/asp:UpdatePanel&gt;
</code></pre>

<p>On the click event of <code>addMappedUser_Click</code> I evaluate the listAllUsers listbox to see what items are selected and create a list of these items</p>

<pre><code>protected void addMappedUser_Click(object sender, EventArgs e)
        {
            List&lt;ListItem&gt; selectedItems = listAllUsers.Items.Cast&lt;ListItem&gt;().Where(i =&gt; i.Selected).ToList();
            List&lt;AddedUsers&gt; newusers = new List&lt;AddedUsers&gt;();
            foreach (var item in selectedItems)
            {
                AddedUsers au = new AddedUsers();
                au.UserID = item.Value;
                au.UserName = item.Text;
                newusers.Add(au);
            }

            MoveSelectedItems(newusers, listAllUsers);
        }
</code></pre>

<p>Once that list is create it is then passed to the <code>MoveSelectedItems Method</code></p>

<pre><code>protected void MoveSelectedItems(List&lt;AddedUsers&gt; from, ListBox to)
        {

            if (from.Count == 0)
            {
                return;
            }

            SecurityUserRole sur = new SecurityUserRole();

            ListItem item = new ListItem();
            foreach (var i in from)
            {
                item.Value = i.UserID;
                item.Text = i.UserName;             
                if (listAllUsers.Items.Contains(item))
                {
                    listAllUsers.Items.Remove(item);
                    listMappedUsers.Items.Add(item);
                }  

                sur.SecurityUserId = Convert.ToInt32(i.UserID);
                sur.SecurityRoleId = Convert.ToInt32(RoleID);
                MappedUser.Add(sur);
                Session["MappedUser"] = MappedUser;
                checkMappingButtons(listMappedUsers, listAllUsers);
                editUserUpdatePanel.Update();
            }
        }
</code></pre>

<p>Where I am getting stuck is in the adding of the users to the second listbox (listMappedUsers.Items.Add) 
When the I set a breakpoint I can see each value pass through (for example "201", "202", "203") however when the updatepanel updates the listbox will only have 203 listed three times. </p>

<p>Can someone help me understand what I am missing and why the last value is the only value appearing in the list box vs it's previous predecessors?</p>

<p>Thanks in advance,</p>
