Hi friends,
I have two drop down lists
in first drop down list I added two items fruits and vegtables
my requirement is If I selected fruits in first drop down list then
list of fruits(like apple,mango)will display in second list box
for this I wrote the following code but it not working
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
switch(DropDownList1.SelectedItem.ToString())
{
case "Fruits":
DropDownList2.Items.Add("Apple");
DropDownList2.Items.Add("mango");
DropDownList2.Items.Add("Grapes");
break;
case "Vegtables":
DropDownList2.Items.Add("Alu");
DropDownList2.Items.Add("Brinjal");
DropDownList2.Items.Add("Carrot");
break;
case "Nuts":
DropDownList2.Items.Add("Badam");
DropDownList2.Items.Add("Kismis");
DropDownList2.Items.Add("Kaaju");
break;
}
}
}
if any one know the answer please tell me.