3
Answers

Dropp Down List

maheswar reddy

maheswar reddy

13y
1.8k
1
Hi all,

   I am facing problem with drop down list.I am controlling from  from one more drop down list.I need to clear 
 
all the items present in second drop down list and add new items my following code is not working .


int n = Convert.ToInt32(DropDownList1.SelectedIndex);
            if (n == 0)
            {
                DropDownList2.Items.Clear();
                DropDownList2.Items.Add("B.E");
                DropDownList2.Items.Add("M.C.A");
                DropDownList2.Items.Add("M.B.A");
            }
            if (n == 1)
            {
                DropDownList2.Items.Clear();
                DropDownList2.Items.Add("Software engineer");
                DropDownList2.Items.Add("Manager");
                DropDownList2.Items.Add("Sales excetive");
                DropDownList2.Items.Add("System operator");
                DropDownList2.Items.Add("Graphics engineer");

            }


WHY it is not working?

Suggest me the way.

Answers (3)