Hi,
I have two Listboxes side by side. First Listbox lists all employee. I
have a button to move selected employee from Listbox 1 to Listbox 2.
If i select multiple employee from ListBox 1 and click on a button to
move to selected employee to ListBox 2, then only alternate selection
is moved.
For example.
If ListBox 1 have employee listed as :
1. John
2. Micheal
3. Bryan
After moving to ListBox 2. It shows:
1. John
2. Bryan
My Code is:
protected void btnAdd_Click(object sender, EventArgs e)
{
for (int LItem = 0; LItem < this.ListBox1.Items.Count; LItem+
+)
{
if (this.ListBox1.Items[LItem].Selected)
{
this.ListBox1.Items[LItem].Selected = false;
this.ListBox2.Items.Add(this.ListBox1.Items[LItem]);
this.ListBox1.Items.Remove(this.ListBox1.Items[LItem]);
}
}
}
}