Calendar: AfterRender Event
It is possible to send custom data from the CallBack event handler back to the client. This will allow showing custom messages after the event was handled.

Example 1: Sending a String
Server-side code (.aspx.cs):
protected void DayPilotCalendar1_TimeRangeSelected(object sender, TimeRangeSelectedEventArgs e)
{
// ... update database
DayPilotCalendar1.DataBind();
DayPilotCalendar1.Update("New event created.");
}Server-side template (.aspx):
<daypilot:daypilotcalendar id="DayPilotCalendar1" runat="server"
...
AfterRenderJavaScript="afterRender(data);" ></daypilot:daypilotcalendar>
Client-side code (.aspx):
function afterRender(data) {
if (data) {
document.getElementById('messageDiv').innerHTML = data;
}
}Example 2: Sending a Dictionary
Server-side code (.aspx.cs):
protected void DayPilotCalendar1_TimeRangeSelected(object sender, TimeRangeSelectedEventArgs e)
{
// ... update database
DayPilotCalendar1.DataBind();
Hashtable ht = new Hashtable();
ht["message"] = "Event moved.";
ht["id"] = e.Value;
DayPilotCalendar1.Update(ht);
}Server-side template (.aspx):
<daypilot:daypilotcalendar id="DayPilotCalendar1" runat="server"
...
AfterRenderJavaScript="afterRender(data);" ></daypilot:daypilotcalendar>
Client-side code (.aspx):
function afterRender(data) {
if (data) {
document.getElementById('messageDiv').innerHTML = data.message + " (id " + data.id + ")";
}
}See Also