I have two ListBoxes bound to DataTables. When I try to move information from one ListBox to another listbox using a button click with the following code:
protected void btnAdd_Click(object sender, EventArgs e){
ListBox1.Items.Add(ListBox2.SelectedItem);
ListBox2.Items.Remove(ListBox2.SelectedItem);
}
One items is removed from ListBox2 and added to ListBox1 but if I try and click the button again with a newly selected item nothing happens.
I’d like to be able to move up to all the items from listbox 1 into listbox 2.
Keep two datatables, one for each list box. Move the items to their respective datatables and on your button click, rebind the listboxes to the datatables.