<asp:ListBox ID="ListBox1" SelectionMode="Multiple" runat="server"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> </asp:ListBox> <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) { ListBox2.Items.Add(item); } } }
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: