I'm currently setting the selected items of listitems in my list box from a sql database using this loop:
foreach (ListItem item in myList.Items)
if (rdr["CODE"].ToString() == item.Value.ToString())
item.Selected = true;
I'm pretty sure this isn't the most efficient method. Can anyone give me an example of the best way to set my selected items in a listbox from a dataset.
Thanks in advance