Hi Frndz,
Create two listbox and two Button for swap first list box to second listbox and viceversa
<asp:ListBox ID="lstFirst" SelectionMode="Multiple" runat="server">
<asp:ListItem Text="first" Value="first"></asp:ListItem>
<asp:ListItem Text="second" Value="second"></asp:ListItem>
<asp:ListItem Text="third" Value="third"></asp:ListItem>
</asp:ListBox>
<asp:ListBox ID="lstSecond" SelectionMode="Multiple" runat="server"></asp:ListBox>
<asp:Button ID="btnSwap1" runat="server" OnClick="BtnSWAPFirst_Click" Text="SWAP1" />
<asp:Button ID="btnSwap2" runat="server" OnClick="BtnSWAPSecond_Click" Text="SWAP2" />
C# Page Button click event Logic for swap one listbox selected item to second listbox
protected void BtnSWAPFirst_Click(object sender, EventArgs e)
{
foreach (ListItem item in lstFirst.Items)
{
if (item.Selected)
lstSecond.Items.Add(item);
}
int Count = lstFirst.Items.Count;
for (int j = 0; j < Count; j++)
{
lstFirst.Items.Remove(lstFirst.SelectedItem);
}
}
protected void BtnSWAPSecond_Click(object sender, EventArgs e)
{
foreach (ListItem item in lstSecond.Items)
{
if (item.Selected)
lstFirst.Items.Add(item);
}
int Count = lstSecond.Items.Count;
for (int j = 0; j < Count; j++)
{
lstSecond.Items.Remove(lstSecond.SelectedItem);
}
}
Hope this helpful!
Thanks