You are firing two HTTP requests (first updates Anthem calendar and the second - executed after the Anthem calendar is updated - updates DayPilotCalendar). The second request fails because Anthem does something with the ViewState (I don't know what exactly yet) that causes "The state information is invalid for this page and might be corrupted." error upon DayPilotCalendar callback.
Theoretically (without this bug) one of the solutions would be this (replacing the default action of day number click by JavaScript action calling refreshCallBack() directly):
<%@ Page Language="C#" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>
<%@ Register TagPrefix="anthem" Namespace="Anthem" Assembly="Anthem" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void DayPilotCalendar1_Refresh(object sender, DayPilot.Web.Ui.Events.RefreshEventArgs e)
{
DayPilotCalendar1.StartDate = e.StartDate; // e.StartDate;
DayPilotCalendar1.DataBind();
DayPilotCalendar1.Update();
}
protected void Page_Load(object sender, EventArgs e)
{
dlUserName.Items.Add(new ListItem("erez", "fes"));
}
protected void cal_DayRender(object sender, DayRenderEventArgs e)
{
e.Cell.Text = "<a href=\"javascript:dpc1.refreshCallBack(new Date('" + DayPilot.Utils.JsDate.FormatDateTime(e.Day.Date) + "'))\">" + e.Day.DayNumberText + "</a>";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Anthem calendar test</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>
Example</h2>
<anthem:Calendar ID="cal" runat="server" EnableCallBack="true" EnableViewState="true"
TextDuringCallBack='<img src="tiny_red.gif" border=0 />'
OnDayRender="cal_DayRender">
</anthem:Calendar>
<DayPilot:DayPilotCalendar ID="DayPilotCalendar1" runat="server" ClientObjectName="dpc1"
OnRefresh="DayPilotCalendar1_Refresh">
</DayPilot:DayPilotCalendar>
<asp:DropDownList ID="dlUserName" runat="server">
</asp:DropDownList>
</div>
</form>
</body>
</html>
That works, but only until the first Anthem callback (e.g. when changing the current month).
The natural solution would be placing DayPilotCalendar inside an Anthem panel. That is not working out of the box because DayPilot requires an initialization JavaScript code to be executed (see
Changing DayPilot StartDate Causes Error for a fix). However, since the time that topic was discussed a lot of DayPilot configuration code was moved from HTML to JavaScript (not only the initialization but the configuration as well) and this fix no longer helps for StartDate changes.
So I can try the following:
1. Take a look at the ViewState issue (if that's something that can be fixed inside DayPilot I will do it).
2. Make the method that generates initialization JavaScript public so you can assign it to PostCallBackFunction in cal_SelectionChanged method.