This error was caused by the following code:
protected void Page_Load(object sender, EventArgs e)
{
DayPilotScheduler1.Resources.Add("One", "1");
DayPilotScheduler1.Resources.Add("Two", "2");
DayPilotScheduler1.Resources.Add("Three", "3");
DayPilotScheduler1.DataSource = getEvents();
DataBind();
}
The Resources collection is persisted across requests using ViewState and calling this code during PostBack requests adds the resources again to the collection. The internal event-arranging code works with an updated Resources collection (with doubled items) but the client-side code works with the original collection (CallBack action is not able to update the Resources collection, only the events). The Resources initialization code should be put it inside "if (!IsPostBack)" block:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DayPilotScheduler1.Resources.Add("One", "1");
DayPilotScheduler1.Resources.Add("Two", "2");
DayPilotScheduler1.Resources.Add("Three", "3");
// having the following two lines outside of the conditional block
// will not produce an error but it will mean extra database
// lookup
DayPilotScheduler1.DataSource = getEvents();
DataBind();
}
}
I've made changes to DayPilot code that will prevent this JavaScript error even if you extend the Resources collection during callback.
But remember that if an existing Resources collection item is changed during callback (e.g. if item "Two" is replaced with "Four") it will still confuse the client during update.