ASP Net Controls ASP.Net Tutorial

<%@ Page Language="VB" %>

    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, _
      ByVal e As System.EventArgs)
        Dim CarArray() As String = {"Ford", "Honda", "BMW", "Dodge"}
        Dim AirplaneArray() As String = {"Boeing 777", "Boeing 747", "Boeing 737"}
        Dim TrainArray() As String = {"Bullet Train", "Amtrack", "Tram"}
        
        If DropDownList1.SelectedValue = "Car" Then
            DropDownList2.DataSource = CarArray
        ElseIf DropDownList1.SelectedValue = "Airplane" Then
            DropDownList2.DataSource = AirplaneArray
        Else
            DropDownList2.DataSource = TrainArray
        End If
        
        DropDownList2.DataBind()
        DropDownList2.Visible = True
    End Sub
    Protected Sub Button1_Click(ByVal sender As Object, _
       ByVal e As System.EventArgs)
        Response.Write("You selected " & _
           DropDownList1.SelectedValue.ToString() & ": " & _
           DropDownList2.SelectedValue.ToString() & "
")
    End Sub



    DropDownList Page


    
    

        Select transportation type:
                 OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" 
         AutoPostBack="true">
            Select an Item
            Car
            Airplane
            Train
         
        
        
                 OnClick="Button1_Click" />