cannot have multiple items selected in a dropdownlist

This error occurs when you set the Selected property of the dropdownlist control and there’s already selected item , example.

dropdownlist.Items.FindByValue(“value”).selected = True

or

dim lst as listitem

lst = dropdownlist.Items.FindByText(“textvalue”)

lst.selected = True

To solve this problem, before you call the above code you need to clear the selection in the dropdownlist.

To clear the selection

dropdownlist.ClearSelection();

, ,

  1. No comments yet.
(will not be published)
Submit Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Subscribe to comments feed
  1. No trackbacks yet.

SetPageWidth