On my form I replaced the advanced form for the scheduler and supply my own custom form. Now, when I insert or update an appointment the scheduler doesn't refresh.
I followed the instructions in the help file how to section titled: "Replace the edit form"
Everything is working nicely, my custom form displays and I can add the appointment after which my OnClientAppointmentInserting handler is called which in turn invokes a call back method that rebinds the scheduler to the updated data source. When the form closes however, the scheduler doesn't refresh and display the newly inserted appointment.
What could I have done wrong? Below is a copy of my markup.
Thanks,
Al
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AppointmentScheduler.aspx.vb" Inherits="AppointmentScheduler" %> | |
<%@ Register assembly="Csla" namespace="Csla.Web" tagprefix="cc1" %> | |
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> | |
<!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"> | |
<title>Appointment Scheduler</title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div> | |
<asp:ScriptManager ID="ScriptManager1" runat="server"> | |
</asp:ScriptManager> | |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server" | |
height="75px" width="75px"> | |
<img alt="Loading..." | |
src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' | |
style="border:0px;" /> | |
</telerik:RadAjaxLoadingPanel> | |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" | |
DefaultLoadingPanelID="RadAjaxLoadingPanel1"> | |
<AjaxSettings> | |
<telerik:AjaxSetting AjaxControlID="RadScheduler1"> | |
<UpdatedControls> | |
<telerik:AjaxUpdatedControl ControlID="RadScheduler1" | |
LoadingPanelID="RadAjaxLoadingPanel1" /> | |
</UpdatedControls> | |
</telerik:AjaxSetting> | |
</AjaxSettings> | |
</telerik:RadAjaxManager> | |
<table border="1"> | |
<tr> | |
<td style="text-align:left; vertical-align:top" > | |
<table border="0"> | |
<tr> | |
<td style="text-align:left; vertical-align:top" nowrap="nowrap"> | |
<asp:DropDownList ID="FacilitiesDropDownList" runat="server" | |
DataSourceID="FacilitiesDataSource" DataTextField="Code" | |
DataValueField="Id" AutoPostBack="True"> | |
</asp:DropDownList> | |
<br /> | |
<asp:CheckBoxList ID="TherapistCheckBoxList" runat="server" | |
DataSourceID="TherapistsDataSource" DataTextField="Name" | |
DataValueField="Id" AutoPostBack="True"> | |
</asp:CheckBoxList> | |
<asp:RadioButtonList ID="TherapistRadioButtonList" runat="server" | |
AutoPostBack="True" DataSourceID="TherapistsDataSource" DataTextField="Name" | |
DataValueField="Id"> | |
</asp:RadioButtonList> | |
</td></tr> | |
</table> | |
</td> | |
<td style="text-align:left; vertical-align:top"> | |
<br /> | |
<telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="EndDate" | |
DataKeyField="AppointmentId" | |
DataSourceID="AppointmentsDataSource" DataStartField="StartDate" | |
DataSubjectField="Subject" GroupBy="Resources" | |
StartEditingInAdvancedForm="False" | |
OnClientAppointmentEditing="AppointmentEditing" | |
OnClientAppointmentInserting="AppointmentInserting"> | |
<ResourceTypes> | |
<telerik:ResourceType DataSourceID="SelectedTherapistsDataSource" | |
ForeignKeyField="ResourceId" KeyField="Id" Name="Resources" | |
TextField="Name" /> | |
</ResourceTypes> | |
</telerik:RadScheduler> | |
</td></tr> | |
</table> | |
<cc1:CslaDataSource ID="TherapistsDataSource" runat="server" | |
TypeAssemblyName="" | |
TypeName="PGS.PTBilling.Business.EmployeeCollection, PGS.PTBilling.Business" | |
TypeSupportsPaging="False" TypeSupportsSorting="False"> | |
</cc1:CslaDataSource> | |
<cc1:CslaDataSource ID="SelectedTherapistsDataSource" runat="server" TypeAssemblyName="" | |
TypeName="PGS.PTBilling.Business.EmployeeCollection, PGS.PTBilling.Business" | |
TypeSupportsPaging="False" TypeSupportsSorting="False"> | |
</cc1:CslaDataSource> | |
<cc1:CslaDataSource ID="FacilitiesDataSource" runat="server" TypeAssemblyName="" | |
TypeName="PGS.PTBilling.Business.FacilityCollection, PGS.PTBilling.Business" | |
TypeSupportsPaging="False" TypeSupportsSorting="False"> | |
</cc1:CslaDataSource> | |
<cc1:CslaDataSource ID="AppointmentsDataSource" runat="server" | |
TypeAssemblyName="" | |
TypeName="PGS.PTBilling.Business.FacilityScheduleInfoCollection, PGS.PTBilling.Business" | |
TypeSupportsPaging="False" TypeSupportsSorting="False"> | |
</cc1:CslaDataSource> | |
<telerik:RadWindowManager ID="AdvancedFormManager" runat="server" | |
onclientclose="refreshScheduler"> | |
<Windows> | |
<telerik:RadWindow runat="server" Behavior="Default" InitialBehavior="None" ID="AdvancedForm" | |
Left="" NavigateUrl="" style="display:none;" Title="Edit an Appointment" Top=""> | |
</telerik:RadWindow> | |
</Windows> | |
</telerik:RadWindowManager> | |
</div> | |
</form> | |
</body> | |
</html> | |
<script language="javascript" type="text/javascript"> | |
function AppointmentEditing(sender, eventArgs) | |
{ | |
//debugger | |
var apt = eventArgs.get_appointment(); | |
window.radopen("AdvancedForm.aspx?Mode=Edit&apptid=" + apt.get_id(), "AdvancedForm"); | |
eventArgs.set_cancel(true); | |
} | |
function AppointmentInserting(sender, eventArgs) | |
{ | |
//debugger | |
var start = formatDate(eventArgs.get_startTime()); | |
var isAllDay = eventArgs.get_isAllDay(); | |
var therapistId = 0; | |
if(eventArgs.get_targetSlot().get_resource() != null) | |
{ | |
therapistId = eventArgs.get_targetSlot().get_resource().get_key(); | |
} | |
var facilityDropDownListBox = document.getElementById("<%=FacilitiesDropDownList.ClientId %>"); | |
var facilityId = facilityDropDownListBox.options[facilityDropDownListBox.selectedIndex].value; | |
// New appointment | |
window.radopen("AdvancedForm.aspx?Mode=Insert&Start=" + start + "&fKey=" + facilityId + "&eKey=" + therapistId, "AdvancedForm"); | |
eventArgs.set_cancel(true); | |
} | |
function formatDate(date) | |
{ | |
//debugger | |
var year = padNumber(date.getUTCFullYear(), 4); | |
var month = padNumber(date.getUTCMonth() + 1, 2); | |
var day = padNumber(date.getUTCDate(), 2); | |
var hour = padNumber(date.getUTCHours(), 2); | |
var minute = padNumber(date.getUTCMinutes(), 2); | |
var fd = year + month + day + hour + minute; | |
return fd; | |
} | |
function padNumber(number, totalDigits) | |
{ | |
numbernumber = number.toString(); | |
var padding = ''; | |
if(totalDigits > number.length) | |
{ | |
for(i = 0; i < (totalDigits - number.length); i++) | |
{ | |
padding += '0'; | |
} | |
} | |
return padding + number; | |
} | |
function refreshScheduler() | |
{ | |
//debugger | |
var ajaxManager = $find("RadAjaxManager1"); | |
ajaxManager.ajaxRequest('RebindScheduler'); | |
} | |
</script> |