Need some help or tip using dropdownlist or gridview


I have a question about how to do one thing.

Say that I have a table with cars.
The key in the table is :
id, year,color, name,  modell
(where id is a number)

I also Have a editbox where the user should be able to search for things.
Ie if I type Chrysler in the box
and there is only one Chrysler  I will start to display some information found in the database based on this record.

However, if there are more than one Chrysler
I want to have a dropdown list saying
Chrysler voyager,  red 1997
Chrysler voyager blue 2002

and let the user select which one to load data from.
When they do a selection I like to display the result as from the first one.

How can I do that.
In some other languages and not for the web I could store complete Car objects
in the dropdown. But I can't se how I can do this here.  
The text I want to have in the dropdown is not enough to have a key to send to the database)

If this could be done with a gridview instead of a radiobutton I would be satisfied.
Who is Participating?
Bob LearnedConnect With a Mentor Commented:
You can bind the DropDownList.DataSource to any complex structure, as in this example:

Binding ASP.NET DropDownList to data structures
pucko73Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.