public partial class Default : System.Web.UI.Page
{
protected string[] Movies ={ "select a movie", "Movie_1", "Movie_2", "Movie_3" };
protected string[] Movie_1={"Theatre_1","Theatre_2","Theatre_3"};
protected string[] Movie_2 ={ "Theatre_4", "Theatre_5" };
protected string[] Movie_3 ={ "Theatre_5", "Theatre_6", "Theatre_7" };
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DropDownList1.DataSource = Movies;
DropDownList1.DataBind();
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.SelectedIndex == 1)
{
DropDownList2.DataSource = Movie_1;
DropDownList2.DataBind();
}
if (DropDownList1.SelectedIndex == 2)
{
DropDownList2.DataSource = Movie_2;
DropDownList2.DataBind();
}
if (DropDownList1.SelectedIndex == 3)
{
DropDownList2.DataSource = Movie_3;
DropDownList2.DataBind();
}
}
}