<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master"
    AutoEventWireup="true" CodeBehind="Default.aspx.cs"
    Inherits="InputDate_Sample._Default" %>

<%@ Register Assembly="C1.Web.Wijmo.Controls.48"
    Namespace="C1.Web.Wijmo.Controls.C1Input"
    TagPrefix="wijmo" %>

<asp:Content ID="BodyContent"
    ContentPlaceHolderID="MainContent"
    runat="server">

    <script>
        var inputDate;
        function Button1_Click() {

            // Get Wijmo control instance
            inputDate = $("#<%= Text1.ClientID %>");

            // Get dropdown value
            var value = document.getElementById("<%= ddlMode.ClientID %>").value;

            var selectedDate = new Date();

            switch (value) {

                case 'TS1':

                    inputDate.c1inputdate('option', 'displayFormat', 'dd/MM/yyyy');
                    inputDate.c1inputdate('option', 'dateFormat', 'dd/MM/yyyy');
                    inputDate.c1inputdate('option', 'date', selectedDate);

                    break;

                case 'TS2':

                    inputDate.c1inputdate('option', 'displayFormat', 'MM/yyyy');
                    inputDate.c1inputdate('option', 'dateFormat', 'MM/yyyy');
                    inputDate.c1inputdate('option', 'date', selectedDate);

                    break;

                case 'TS3':

                    inputDate.c1inputdate('option', 'displayFormat', 'yyyy');
                    inputDate.c1inputdate('option', 'dateFormat', 'yyyy');
                    inputDate.c1inputdate('option', 'date', selectedDate);

                    break;
            }
        }

    </script>

    <wijmo:C1InputDate ID="Text1" runat="server"></wijmo:C1InputDate>

    <br />
    <br />

    <label>Mode</label>

    <asp:DropDownList ID="ddlMode" runat="server">

        <asp:ListItem Text="TS1 — Hourly" Value="TS1" />
        <asp:ListItem Text="TS2 — Monthly" Value="TS2" />
        <asp:ListItem Text="TS3 — Annually" Value="TS3" />

    </asp:DropDownList>

    <br />
    <br />

    <button id="Button1"
        type="button"
        onclick="Button1_Click()"
        class="btn btn-primary">

        Calculate Range

    </button>

</asp:Content>