locked
Using Any+Time™ DatePicker/TimePicker AJAX Calendar Widget with ASP.NET masterpage RRS feed

  • Question

  • User-718146471 posted

    Maybe its a Friday issue, not sure.  I'm trying to use Any+Time™ DatePicker/TimePicker AJAX Calendar Widget where I store the JS files on my masterpage.  What I'm trying to accomplish is when I click on my TextBox, I'm trying to bring up their AJAX style calander that has a time picker on it.  I click the textbox and i get a JS error, "AnyTime is undefined."  Here is the code:

    MasterPage Header:

    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Primary.master.cs" Inherits="PRIMARY" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajx" %>
    <!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 id="Head1" runat="server">
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />    
        <link href="systems.css" rel="stylesheet" type="text/css" />
        <link href="MainSite.css" rel="stylesheet" type="text/css" />
        <link href="anytime.css" rel="stylesheet" type="text/css" />
        <title>Main Site</title>
    
        <style type="text/css">
            .style1
            {
                text-align: left;            
            }
            .template-checkbox 
            {
                   text-align:center;
            }
        </style>
    </head>
    <body style="background-image: url(images/BKG.jpg)">
        <form id="form1" runat="server">
        <ajx:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" ScriptMode="Release">
        </ajx:ToolkitScriptManager>
        <script type="text/javascript" src="Scripts/jquery.js"></script>
        <script type="text/javascript" src="Scripts/anytime.js"></script> 
    <%--    <script type="text/javascript" src="Scripts/anytimetz.js"></script>--%>
        <script type="text/javascript" src='Scripts/tooltips.js'></script>
    

    Report Page:

    <%@ Page Title="Custom Report - Dates and Regions" Language="C#" MasterPageFile="~/Primary.master" AutoEventWireup="true" CodeFile="CustomReport.aspx.cs" Inherits="Report_Default" %>
    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
    <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <p>
        <asp:Label ID="lblPlannedStart" runat="server" Text="Planned Start"></asp:Label>
    &nbsp;<asp:TextBox ID="txtPlanned_Start" runat="server" Width="200px" OnClick="AnyTime.picker('txtPlanned_Start');"></asp:TextBox>
        <br />
        <asp:Label ID="lblPlannedEnd" runat="server" Text="Planned End"></asp:Label>
    &nbsp;
        <asp:TextBox ID="txtPlanned_End" runat="server" Width="200px" OnClick="AnyTime.picker('txtPlanned_Start');"></asp:TextBox>
    </p><p>

    So, any ideas what I'm doing wrong?  I'm putting the JS/CSS on my masterpage so this is available to other pages that use date/time ranges.

    Friday, March 7, 2014 8:56 AM

Answers

  • User1208776063 posted

    I would recommend adding a script reference to ScriptManager's <scripts></scripts> block instead of html script tag.  That will make sure that scripts are registered before the control loads.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 7, 2014 9:40 AM

All replies

  • User1208776063 posted

    I would recommend adding a script reference to ScriptManager's <scripts></scripts> block instead of html script tag.  That will make sure that scripts are registered before the control loads.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 7, 2014 9:40 AM
  • User-718146471 posted

    Stupid typographical error, misspelled my jquery file name. Sometimes its the little things that cause the most grief.  Thank you for bearing with me. :)

    Friday, March 7, 2014 10:29 AM
  • User-718146471 posted

    Ok, I'm back with a different situation. I'm going to open a new thread for that. Thanks!

    Friday, March 7, 2014 10:36 AM