I am trying to do a javascript callback to handle the move of an event.
ASPX:
<DayPilot:DayPilotCalendar ID="schedule" runat="server" HeightSpec="Full" CellsPerHour="4" ShowHeader="true" ViewType="Resources" DataStartField="start" DataEndField="end" DataTextField="description" DataValueField="service_id" DataColumnField="column" HeaderHeight="40" Width="100%" EventMoveHandling="JavaScript" EventMoveJavaScript="Schedule_onMoveAppointment(e, newStart, newEnd, oldColumn, newColumn)" OnEventMove="schedule_EventMove">
</DayPilot:DayPilotCalendar>
JAVASCRIPT:
function Schedule_onMoveAppointment(eventArgs, newStart, newEnd, oldColumn, newColumn)
{
alert("newStart:" + newStart + "\n\rnewEnd:" + newStart + "\n\roldColumn:" + oldColumn + "\n\rnewColumn:" + newColumn);
alert(eventArgs.value());
_ctl0_MainPageContent_schedule.eventMoveCallBack(eventArgs, newStart, newEnd, oldColumn, newColumn);
}
SERVER SIDE:
protected void schedule_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e)
{
// Update your database
// ...
DataRow[] dr = dsObjResults.Tables["getsched"].Select("service_id = " + e.Value);
if (dr.Length > 0)
{
dr[0]["startafter"] = System.Convert.ToInt16(e.NewStart.ToString("HHmm"));
dr[0]["schedtime"] = System.Convert.ToInt16(e.NewStart.ToString("HHmm"));
dr[0]["endbefore"] = System.Convert.ToInt16(e.NewEnd.ToString("HHmm"));
dr[0]["startdate"] = Convert.ToDateTime(e.NewStart.ToShortDateString());
}
DataTable dt = CreateDayPilotTable(dsObjResults.Tables["getsched"]);
schedule.DataSource = dt;
schedule.DataBind();
schedule.Update();
hdnPageXml.Value = DataUtils.GetXmlFromDataSet(dsObjResults, true);
}
All of the code gets executed, and I have debugged to see that the datatable contains the correct data. The call finishes and the calendar does not reflect the event move. Any idea what I am doing wrong?