-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefault.aspx.cs
30 lines (25 loc) · 1.15 KB
/
Default.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1_SelectedIndexChanged(sender, e);
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList2.Items.Clear();
Dictionary<string, List<string>> dictCars = new Dictionary<string, List<string>>() {
{ "Toyota", new List<string> () {"Yaris", "Corolla", "Corona", "Camry"} },
{ "Mazda" , new List<string> {"Demio", "Mazda 3", "Mazda 6"} },
{ "Ford" , new List<string> {"Laser", "Cortina", "Territory"} },
{ "Subaru", new List<string> {"Impreza", "Legacy", "Forester", "Outback" } } };
DropDownList2.DataSource = dictCars[DropDownList1.SelectedValue];
DropDownList2.DataBind();
}
}