Setting Value of Dropdown List from Array

  • Thread starter Thread starter George
  • Start date Start date
G

George

I am trying to set the value of items in a dropdown list dynamically, and
can't seem to figure out how to do it.

I have two arrays set up like this:

Dim a() as string ={"A", "B", "C"}
Dim b() as string ={"1", "2", "3"}

I can get the first array in the items list like this:

DrpDwnLst1.Datasource = a
DrpDwnLst1.Databind()

However, I need to also set the values for each item in string a to the
values in string b. I know you can create a dataset for pulling that info
out of a db, but can't find anything in the help files that tells you how to
do it with an array.

Apparently, DataMember, DataTextField, and DataValueField are for setting
the items one by one, or by referring to a dataset, but they don't seem to
work with an array. Any help on how to do this would be appreciated.

George
 
Back
Top