<%@ Page Language="C#" Inherits="HawhawPage" %>
<%@ Register Assembly="Hawhaw" Namespace="Hawhaw" TagPrefix="Haw" %>

<!--
        HAWHAW example for a DropDownList
        Norbert Huffschmid
        22.3.2009
        
        (Due to ASP.NET's Viewstate capability and single-form model
         there is no need for a HiddenField element in HAWHAW.NET)
-->

<script runat="server">

    protected void OnMealSelected(object sender, EventArgs e)
    {
        // meal has been selected, now we'll ask for the drink

        question1.Visible = false;
        meal.Visible = false;

        question2.Visible = true;
        drink.Visible = true;
    }

    protected void OnDrinkSelected(object sender, EventArgs e)
    {
        // drink has been selected too, we're done

        inputForm.Visible = false;

        Hawhaw.Label order = new Hawhaw.Label();
        order.Text ="You ordered " + meal.Value + " with " + drink.Value + ".";
        order.Bold = true;
        deck.Controls.Add(order);

        Hawhaw.Label delivery = new Hawhaw.Label();
        delivery.Text ="Your order will arrive in 30 minutes.";
        deck.Controls.Add(delivery);

        deck.HorizontalAlign = Deck.Alignment.Center;
    }

    </script>

<Haw:Deck runat="server" ID="deck" Title="Example 5" Simulator="Skin">

    <!-- This label is filled programmatically after postback -->
    <Haw:Label runat="server" Text="" ID="solution" Visible="False" />

    <Haw:Form runat="server" ID="inputForm">
    
        <Haw:Label runat="server" ID="question1" Text="What do you want to eat?" />
        <Haw:DropDownList runat="server" ID="meal" OnSelectionChanged="OnMealSelected" > 
            <Haw:ListItem runat="server" Text="Pizza" Value="pizza" />
            <Haw:ListItem runat="server" Text="Sushi" Value="sushi" />
            <Haw:ListItem runat="server" Text="Pasta" Value="pasta" />
            <Haw:ListItem runat="server" Text="Sandwich" Value="sandwich" />
        </Haw:DropDownList>
        
        <Haw:Label runat="server" ID="question2" Text="And what do you want to drink?" Visible="false" />
        <Haw:DropDownList runat="server" ID="drink" Visible="false" OnSelectionChanged="OnDrinkSelected"> 
            <Haw:ListItem runat="server" Text="Coke" Value="coke" />
            <Haw:ListItem runat="server" Text="Beer" Value="beer" />
            <Haw:ListItem runat="server" Text="Wine" Value="wine" />
        </Haw:DropDownList>
        
        <Haw:Button runat="server" Text="Continue" />
        
    </Haw:Form>

</Haw:Deck>