Posts Tagged ‘dropdownlist’

How to search string in the DropdownList Control

  1.  
  2. function searchString(sText as String)
  3. dim li as ListItem
  4.  
  5. li = dropdownlist1.Items.FindByValue(sText);
  6.  
  7. if li isnot nothing then
  8.  
  9. li.selected = True
  10.  
  11. end if
  12.  
  13.  
  14. end function

, ,

No Comments


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();

, ,

No Comments



SetPageWidth