Dropdownlist in C#??

  • Thread starter Thread starter Hai Nguyen
  • Start date Start date
H

Hai Nguyen

Hi everyone

I'm developing an wep application, I got stuck into a problem.
My database has a table which has 2 fields
Table1

X Y
A Apple
B Banana
C Cat
D Dog

I would like to ask if there is a way so that I can add these two columns
into my dropdown list which will look like this

Apple
Banna
Cat
Dog

whichever values I select from the dropdownlist I wold like to get the
equivalent value; for instance
if I choose Cat, I want to get the value C for later use.

Thanks for any help
 
Hai said:
whichever values I select from the dropdownlist I wold like to get the
equivalent value; for instance
if I choose Cat, I want to get the value C for later use.

Set the DropdownList's DataSource property to your table. The DataText
(going from memory on this one, double check) property indicates which
field supplies the values shown in the box while the DataValue property
determnes what the value for that text will be.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
 
Back
Top