ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Move listbox items to another listbox using C# in ASP.Net<p>Please refer this example</p> <p><span style="text-decoration: underline;">HTML</span></p> <pre class="brush: html">&lt;div style=&#34;max-width: 200; float: left;&#34;&gt; &lt;asp:ListBox ID=&#34;lbLeftListBox&#34; runat=&#34;server&#34; SelectionMode=&#34;Multiple&#34;&gt; &lt;asp:ListItem Text=&#34;PC&#34; Value=&#34;PC&#34; /&gt; &lt;asp:ListItem Text=&#34;LapTop HP&#34; Value=&#34;LapTop HP&#34; /&gt; &lt;asp:ListItem Text=&#34;DELL&#34; Value=&#34;DELL&#34; /&gt; &lt;asp:ListItem Text=&#34;Key Board&#34; Value=&#34;Key Board&#34; /&gt; &lt;/asp:ListBox&gt; &lt;/div&gt; &lt;div style=&#34;max-width: 300; float: left; margin-left: 5px; margin-top: 10px;&#34;&gt; &amp;nbsp; &lt;asp:LinkButton ID=&#34;lnkPassRight&#34; Text=&#34;&gt;&gt;&#34; OnClick=&#34;PassRight&#34; runat=&#34;server&#34;&gt;&lt;/asp:LinkButton&gt; &lt;br /&gt; &lt;asp:LinkButton ID=&#34;lnkPassLeft&#34; Text=&#34;&lt;&lt;&#34; OnClick=&#34;PassLeft&#34; runat=&#34;server&#34;&gt;&lt;/asp:LinkButton&gt; &amp;nbsp; &lt;/div&gt; &lt;div style=&#34;width: 300; margin-left: 10px;&#34;&gt; &lt;asp:ListBox ID=&#34;lbRightListBox&#34; runat=&#34;server&#34; SelectionMode=&#34;Multiple&#34;&gt;&lt;/asp:ListBox&gt; &lt;/div&gt; &lt;/form&gt;</pre> <p><span style="text-decoration: underline;">C#</span></p> <pre class="brush: csharp">protected void PassRight(object sender, EventArgs e) { foreach (ListItem item in this.lbLeftListBox.Items) { if (item.Selected) { this.lbRightListBox.Items.Add(new ListItem(item.Text, item.Value)); } } foreach (ListItem item in this.lbRightListBox.Items) { this.lbLeftListBox.Items.Remove(item); } } protected void PassLeft(object sender, EventArgs e) { foreach (ListItem item in this.lbRightListBox.Items) { if (item.Selected) { this.lbLeftListBox.Items.Add(new ListItem(item.Text, item.Value)); } } foreach (ListItem item in this.lbLeftListBox.Items) { this.lbRightListBox.Items.Remove(item); } }</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/176930/Move-listbox-items-to-another-listbox-using-C-in-ASPNet/https://www.aspforums.net:443/Threads/176930/Move-listbox-items-to-another-listbox-using-C-in-ASPNet/Sat, 30 Aug 2014 01:48:28 GMT