There are two dropDownLists on my form. In one DropDownList items
are-
1)BE
2)Drawing
3)PG
I want if a user selects BE in dropdownlist3 then in dropDownlist4 items are
IT, CSE, MECH
I want if a user selects Drawing in dropdownlist3 then in dropDownlist4 items are
Drawing1, Drawing2
I want if a user selects PG in dropdownlist3 then in dropDownlist4 items are
MBA, MSC, MCA
I do the foll. coding,but errors are there--
Check it out--
public partial class _Default : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
DropDownList3.I tems.Clear();
DropDownList3.I tems.Add("BE");
DropDownList3.I tems.Add("Drawi ng");
DropDownList3.I tems.Add("PG");
}
protected void DropDownList3_S electedIndexCha nged(object sender, EventArgs e)
{
if (DropDownList3. SelectedItem ="BE")
{
DropDownList4.I tems.Clear();
DropDownList4.I tems.Add("IT");
DropDownList4.I tems.Add("CSE") ;
DropDownList4.I tems.Add("MECH" );
}
else if (DropDownList3. SelectedItem ="Drawing")
{
DropDownList4.I tems.Clear();
DropDownList4.I tems.Add("Drawi ng 1");
DropDownList4.I tems.Add("Drawi ng 2");
}
else
{
DropDownList4.I tems.Clear();
DropDownList4.I tems.Add("MBA") ;
DropDownList4.I tems.Add("MSC") ;
DropDownList4.I tems.Add("MCA") ;
}
}
}
But Its not working.
are-
1)BE
2)Drawing
3)PG
I want if a user selects BE in dropdownlist3 then in dropDownlist4 items are
IT, CSE, MECH
I want if a user selects Drawing in dropdownlist3 then in dropDownlist4 items are
Drawing1, Drawing2
I want if a user selects PG in dropdownlist3 then in dropDownlist4 items are
MBA, MSC, MCA
I do the foll. coding,but errors are there--
Check it out--
public partial class _Default : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
DropDownList3.I tems.Clear();
DropDownList3.I tems.Add("BE");
DropDownList3.I tems.Add("Drawi ng");
DropDownList3.I tems.Add("PG");
}
protected void DropDownList3_S electedIndexCha nged(object sender, EventArgs e)
{
if (DropDownList3. SelectedItem ="BE")
{
DropDownList4.I tems.Clear();
DropDownList4.I tems.Add("IT");
DropDownList4.I tems.Add("CSE") ;
DropDownList4.I tems.Add("MECH" );
}
else if (DropDownList3. SelectedItem ="Drawing")
{
DropDownList4.I tems.Clear();
DropDownList4.I tems.Add("Drawi ng 1");
DropDownList4.I tems.Add("Drawi ng 2");
}
else
{
DropDownList4.I tems.Clear();
DropDownList4.I tems.Add("MBA") ;
DropDownList4.I tems.Add("MSC") ;
DropDownList4.I tems.Add("MCA") ;
}
}
}
But Its not working.
Comment