I have a listbox being populated from a SQLDATA pull, and it pulls down some columns that i dont want like OBJECT_dfj, OBJECT_daskd. The key is all of these being with OBJE
protected void lbAddtoDestination_Click(object sender, EventArgs e)
{
AddRemoveItemsListBox(lstSourceSkills, lstDestinationSkills);
}
protected void lbRemovefromDestination_Click(object sender, EventArgs e)
{
AddRemoveItemsListBox(lstDestinationSkills, lstSourceSkills);
}
private void AddRemoveItemsListBox(ListBox source, ListBox destination)
{
List toBeRemoved = new List();
foreach (ListItem item in source.Items)
{
if (item.Selected)
{
toBeRemoved.Add(item);
destination.Items.Add(item);
}
}
foreach (ListItem item in toBeRemoved) source.Items.Remove(item);
}