<%@ Page Language="VB" %>

<script runat="server">
    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 = "Samochód" Then
            DropDownList2.DataSource = CarArray
        ElseIf DropDownList1.SelectedValue = "Samolot" Then
            DropDownList2.DataSource = AirplaneArray
        ElseIf DropDownList1.SelectedValue = "Pociąg" Then
            DropDownList2.DataSource = TrainArray
        End If

        DropDownList2.DataBind()
        DropDownList2.Visible = (DropDownList1.SelectedValue <> "Wybierz pozycję")

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, _
       ByVal e As System.EventArgs)

        Response.Write("Wybrałeś <b>" & _
           DropDownList1.SelectedValue.ToString() & ": " & _
           DropDownList2.SelectedValue.ToString() & "</b>")
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Strona DropDownList</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Wybierz rodzaj transportu:<br />
        <asp:DropDownList ID="DropDownList1" runat="server" 
         OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" 
         AutoPostBack="true">
            <asp:ListItem>Wybierz pozycję</asp:ListItem>
            <asp:ListItem>Samochód</asp:ListItem>
            <asp:ListItem>Samolot</asp:ListItem>
            <asp:ListItem>Pociąg</asp:ListItem>
        </asp:DropDownList>&nbsp;
        <asp:DropDownList ID="DropDownList2" runat="server" Visible="false">
        </asp:DropDownList>
        <asp:Button ID="Button1" runat="server" Text="Wybierz opcję" 
         OnClick="Button1_Click" />
    </div>
    </form>
</body>
</html>
