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.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.Items.Clear();
DropDownList3.Items.Add("BE");
DropDownList3.Items.Add("Drawing");
DropDownList3.Items.Add("PG");
}
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList3.SelectedItem =="BE")
{
DropDownList4.Items.Clear();
DropDownList4.Items.Add("IT");
DropDownList4.Items.Add("CSE");
DropDownList4.Items.Add("MECH");
}
else if (DropDownList3.SelectedItem =="Drawing")
{
DropDownList4.Items.Clear();
DropDownList4.Items.Add("Drawing 1");
DropDownList4.Items.Add("Drawing 2");
}
else
{
DropDownList4.Items.Clear();
DropDownList4.Items.Add("MBA");
DropDownList4.Items.Add("MSC");
DropDownList4.Items.Add("MCA");
}
}
}