Populate ListBox using selected Items of other ListBox Control.

Posted by Madhuk under ASP.NET category on | Points: 40 | Views : 3362
The following code is to populate the listbox items which are the selected items in other ListBox.

<asp:ListBox ID="ListBox1" SelectionMode="Multiple"  runat="server">
<asp:ListBox ID="ListBox2" SelectionMode="Multiple" runat="server"></asp:ListBox>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

protected void Button1_Click(object sender, EventArgs e)
foreach (ListItem item in ListBox1.Items)
if (item.Selected == true)

Comments or Responses

Login to post response