search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

DayPilotMonth is undefined

Asked by Ian Chan
12 years ago.

i am getting this Javascript error "DayPilotMonth is undefined" after getting the 4.6.1389 build from you guys to fix the next month bug yesterday (3/31).

<script type='text/javascript'>
function dpm_Init() {
var v = new DayPilotMonth.Month('DayPilotMonth1'); <--------------error points to this line, script from you guys, not o ur code.

Comment posted by Ian Chan
12 years ago.
also, same error for daypilotweek and scheduler
Comment posted by Ian Chan
12 years ago.
hmm, weird, the above error i was getting while setting my date back to yesterday(3/31), now i set it back i am getting a different javascript error. 'HeaderBackColor' is null or not an object on some of my calendars, some works.
Comment posted by Ian Chan
12 years ago.
also the monthview filesare gone from the demo codes
Comment posted by Dan Letecky
12 years ago.
The "DayPilotMonth is undefined" error can happen in two cases:
  • The JavaScript code is not properly loaded (it's loaded using WebResources.axd reference).
  • There is an syntax error inside the JavaScript code. That prevents the DayPilotMonth class from being defined.
I've tried the build 1389 and it seems that it's not caused by a syntax error (the demo works fine).

I would suggest that you try reloading the page using Ctrl+F5. If that doesn't help, try to look at the actual WebResource.axd content - Firefox + Firebug might help here. There will at least two WebResource.axd references: one defining DayPilotMonth (Month.js in the sources) and common definitions (Common.js in the sources).

It might render ASP.NET exception page instead of the JavaScript code in some cases. It can happen if you use URL redirection, authentication, etc.
Comment posted by Dan Letecky
12 years ago.
The month view demo was moved from Demo/Calendar/MonthView.aspx to Demo/Month/Default.aspx.
Comment posted by Ian Chan
12 years ago.

<script src="/WebResource.axd?d=tH6T-w3oY7ab0jjq_9haMyxj96L4_7VwoGenRl41ulXBLeMD5GyyP-e3b1Vel98w0&amp;t=633426324080000000" type="text/javascript"></script>
<script src="/WebResource.axd?d=tH6T-w3oY7ab0jjq_9haM9iI1_4VetEUReKlmjNEgOui8qNM4eTE1uyeN0bAba-V0&amp;t=633426324080000000" type="text/javascript"></script>
<script src="/WebResource.axd?d=tH6T-w3oY7ab0jjq_9haM102MPbJ0yqj4M_BvKxajlKM5oL6F9IpzuL1xa9UPewd0&amp;t=633426324080000000" type="text/javascript"></script>

i checked all three of these .axd and they all seems to load fine.

My page is as simple as this.

<%@ Page Language="C#" AutoEventWireup="false" CodeBehind="Calendar.aspx.cs" Inherits="Portal.Controls.Shared.Scheduler.Calendar" Title="Event Calendar" %>
<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>

<!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">

</head>
<body>
<form id="form1" runat="server">
<div style="width: 100%">
<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" />
<div style="text-align: left"><asp:Literal ID="litName" runat="server"></asp:Literal></div>
<div style="text-align: center; width: 100%">
<asp:Button ID="btnPrev" BorderStyle="Inset" BorderWidth="1px" BorderColor="Navy" ForeColor="Navy" BackColor="White" runat="server" Text="" />
<span style="font-weight: bold; font-size: 1.5em;">
<asp:Literal ID="Literal1" runat="server" Text="Label"></asp:Literal>
</span>
<asp:Button ID="btnNext" BorderStyle="Inset" BorderWidth="1px" BorderColor="Navy" ForeColor="Navy" BackColor="White" runat="server" Text="" />
</div>
<DayPilot:DayPilotMonth ID="DayPilotMonth1" runat="server" ClientObjectName="dpm" BubbleID="bubble" />
<DayPilot:DayPilotBubble ID="bubble" runat="server" Width="250" ClientObjectName="dpb" UseShadow="true"></DayPilot:DayPilotBubble>

</div>
</form>
</body>
</html>

Comment posted by Dan Letecky
12 years ago.
OK, I'm going to test it with your code.
Comment posted by Dan Letecky
12 years ago.
Oh, sorry. I can see the problem now. This happens only when you don't handle BeforeCellRender event. I'm sending a fixed build.
Comment posted by Ian Chan
12 years ago.

with the new build i am getting the DaypilotMonth is undefined again.

loading the .axd (WebResource.axd?d=tH6T-w3oY7ab0jjq_9haMyxj96L4_7VwoGenRl41ulXBLeMD5GyyP-e3b1Vel98w0&amp;t=633426735000000000) gets me this error.

Specified argument was out of the range of valid values.
Parameter name: utcDate

my other scheduler and week view throws same error too.

Comment posted by Ian Chan
12 years ago.
hmm, it works on my coworker's machine. I think it has something to do with my date time setting on my local.
Comment posted by Dan Letecky
12 years ago.
It seems that this exception is caused by the ASP.NET server system date being smaller than an assembly build date (see also http://www.google.com/search?q=utcDate+specified+argument).
It happens because you are you have set your computer's date to 3/31/2008 and the daypilot.dll build date is 4/1/2008.
Comment posted by Ian Chan
12 years ago.
ahh, ok. Everything seems fine now, thank you for the quick response. Appreciate it.
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.