Populating Drop down box value

G

Guest

Hello,

i want to populate the drop down box values based on the first drop down box
value, actually i have form in which user will select a car maker and based
on that value below 2 drop down box values will be populated
For example user select Suzuki and based on that value in one drop down car
models will be shown and in secound one car type will be shown, how can i do
it in ASP.NET, please tell me, i'm using MS-Access DB.
Thanks.
 
S

Stephen

in the onselectedindexchanged event of the first control you need to
bind the second dropdown to a datasource passing the selected item
value from the first dropdown (control.selecteditem.value)

for instance:

if model id is an integer:

string selectCommand = "select model_id, model from table where
model_id =" + ddlMake.selecteditem.value;

if model id is an string:

string selectCommand = "select model_id, model from table where
model_id ='" + ddlMake.selecteditem.value + "'";
 

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,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top