Setting Value of Dropdown List from Array

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top