<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="OrderDelivery._Default" %>

<%@ Register Assembly="RadComboBox.Net2" Namespace="Telerik.WebControls" TagPrefix="radC" %>
<%@ Register Assembly="RadInput.Net2" Namespace="Telerik.WebControls" TagPrefix="radI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title>r.a.d.input</title>

  <script type="text/javascript">
    //<!--
    
        // detects new enumeration value selected from the 
        // hint and maps to a display message in the status label
        function ClientEnumerationChangedHandler(input, args)
        {
          if (args.OldValue != args.NewValue)
          {                                
            switch (args.NewValue){
                case "Morning": 
                    DisplayStatus("Delivery will be between 9am and 12pm"); 
                    break;
                case "Afternoon": 
                    DisplayStatus("Delivery will be between 12pm and 5pm"); 
                    break; 
                case "Evening": 
                    DisplayStatus("Delivery will be between 5pm and 9pm"); 
                    break;  
            }                    
          }
        }

        // displays an invalid key press
        function ClientErrorHandler(input, args)
        {
            DisplayStatus("Invalid character:" + args.NewValue); 
        }        

        // displays the selected old and new date 
        function ClientDateChangedHandler(input, args)
        {
          if (args.OldDate != args.NewDate)
          {
            var date = args.NewDate; 
            if (date.getYear() != 80) // not the default date
            {
                var mmddyy = date.getMonth() + "/" + date.getDay() + "/" + date.getYear(); 
                DisplayStatus("Your appointment is rescheduled to " + mmddyy); 
            }
          }            
        }
        
        // displays a text message in the status label
        function DisplayStatus(message)
        {
            var lblStatus = document.getElementById('lblStatus');
            if (lblStatus)
            {               
                lblStatus.innerHTML = message; 
            }
        }

        //-->
  </script>

  <link href="RadControls/Input/Skins/Office2007/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
  <form id="form1" runat="server">
    <fieldset>
      <legend>Order Delivery Information</legend>
      <radI:RadMaskedTextBox ID="rmtbFirst" runat="server" CatalogIconImageUrl="" Description=""
        DisplayPromptChar="_" Label="First:" Mask="Llllllllll" PromptChar="_" Skin="Office2007"
        Width="89px" OnClientError="ClientErrorHandler" LabelCssClass="Label_Office2007"></radI:RadMaskedTextBox>
      <asp:RequiredFieldValidator ID="valFirst" runat="server" ErrorMessage="First name is required"
        ControlToValidate="rmtbFirst"></asp:RequiredFieldValidator><br />
      <radI:RadMaskedTextBox ID="rmtbLast" runat="server" DisplayPromptChar="_" Label="Last:"
        Mask="Llllllllll" PromptChar="_" Skin="Office2007" Width="89px" OnClientError="ClientErrorHandler"
        LabelCssClass="Label_Office2007"></radI:RadMaskedTextBox>
      <asp:RequiredFieldValidator ID="valLast" runat="server" ControlToValidate="rmtbLast"
        ErrorMessage="Last name is required"></asp:RequiredFieldValidator><br />
      <radI:RadMaskedTextBox ID="rmtbPhone" runat="server" CatalogIconImageUrl="" Description=""
        DisplayPromptChar="_" Label="Phone:" Mask="##########" PromptChar="_" Skin="Office2007"
        Width="89px" OnClientError="ClientErrorHandler" DisplayMask="(###) ###-####" LabelCssClass="Label_Office2007"></radI:RadMaskedTextBox><br />
      <radI:RadDateInput ID="rdiDate" runat="server" Description="" Label="Delivery Date:"
        Width="89px" Skin="Office2007" OnClientDateChanged="ClientDateChangedHandler" AllowEmpty="True"
        EmptyMessage="Enter date" HideOnBlur="True" SelectedDate="1980-01-01" LabelCssClass="Label_Office2007"></radI:RadDateInput>
      <asp:RequiredFieldValidator ID="valDeliveryDate" runat="server" ControlToValidate="rdiDate"
        ErrorMessage="Delivery date is required"></asp:RequiredFieldValidator><br />
      <radI:RadMaskedTextBox ID="rmtbTime" runat="server" DisplayPromptChar="_" Label="Delivery Time:"
        PromptChar="_" ShowHint="True" OnClientEnumerationChanged="ClientEnumerationChangedHandler"
        Width="89px" Skin="Office2007" OnClientError="ClientErrorHandler" LabelCssClass="Label_Office2007">
      </radI:RadMaskedTextBox><br />
      <br />
      <asp:Panel ID="pnlNotes" runat="server" Height="97px" Width="100%" HorizontalAlign="Center"
        ScrollBars="Vertical">
      </asp:Panel>
      <hr />
      <asp:Panel ID="pnlButtons" runat="server" HorizontalAlign="Right" Width="100%" Height="29px">
        &nbsp;<asp:Button ID="btnAddNotes" runat="server" OnClick="btnAddNotes_Click" Text="Add Notes" />
        <asp:Button ID="btnDeliver" runat="server" Text="Deliver" OnClick="btnDeliver_Click" /></asp:Panel>
      <asp:Label ID="lblStatus" runat="server" CssClass="Label_Office2007" Width="100%"></asp:Label>
    </fieldset>
  </form>
</body>
</html>
