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

<!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></title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
    <telerik:RadCodeBlock runat="server">
        <script type="text/javascript">
            var currentDate;
            function OnDateClick(sender, eventArgs)
            {
                var calendar = $find("<%=RadDatePicker1.ClientID  %>");
                var dateTriplet = eventArgs.get_renderDay().get_date();
                currentDate = new Date(dateTriplet[0], dateTriplet[1] -1, dateTriplet[2]);
                calendar._setCalendarDate(currentDate);
                eventArgs.set_cancel(true);
            }
            function todayButtonClick()
            {
                var calendar = $find("<%=RadDatePicker1.ClientID  %>");
                currentDate = new Date();
                calendar._setCalendarDate(currentDate);
            }

            function okButtonClick()
            {
                 var calendar = $find("<%=RadDatePicker1.ClientID  %>");
                 calendar.set_selectedDate(currentDate);
                 calendar.hidePopup();
            }
        </script>
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
        <telerik:RadDatePicker runat="server" ID="RadDatePicker1">
            <Calendar runat="server">
                <FooterTemplate>
                    <asp:Button runat="server" Text="Today" OnClientClick="todayButtonClick(); return false;" ID="Button1" />
                    <asp:Button runat="server" Text="OK" OnClientClick="okButtonClick(); return false;" ID="Button2" />
                </FooterTemplate>
                <ClientEvents OnDateClick="OnDateClick" />
            </Calendar>
            
        </telerik:RadDatePicker>
    </div>
    </form>
</body>
</html>
