Friday, March 16, 2012

Populating Drop down box value

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.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 + "'";

0 comments:

Post a Comment