0
votes

I have two listboxes, Listbox1 and Listbox2. When I select few values from Listbox1 to Listbox2 and hit save the first item on the listbox2 gets recorded into the database but I can see still see all the all the items on Listbox2 when I hit edit from saved list in webpage. Now when I want to clear listbox2 in edit mode i.e. move all the selected items in Listbox2 to list box 1 and hit save, database gets cleared, no values are saved but my Listbox2 donot clear those items. Any suggestions?

1

1 Answers

0
votes

You can use Linq to set all the ListItems selections to false.

ListBox1.Items.Cast<ListItem>().ToList().ForEach(x => x.Selected = false);