C# Error: Cannot have multiple items selected in a DropDownList

Error

Cannot have multiple items selected in a DropDownList

Solution

This message means that you're trying to select an item and another one is already selected. To solve this problem you've to clear the previous selection an then select the new one, like this:
myDropDownList.ClearSelection();
myDropDownList.Items.FindByValue(myValue).Selected = true;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.