This is a migrated thread and some comments may be shown as answers.

Scheduler doesn't refresh

6 Answers 304 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Albert
Top achievements
Rank 1
Albert asked on 14 Jul 2008, 06:09 PM

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> 

6 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 15 Jul 2008, 06:24 AM
Hi Albert,

In order to update the scheduler as a result of a call to ajaxRequest, you need to add the following AjaxSetting:

<telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
    <UpdatedControls> 
        <telerik:AjaxUpdatedControl ControlID="RadScheduler1" /> 
    </UpdatedControls> 
</telerik:AjaxSetting> 

I hope this helps.

Best wishes,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Albert
Top achievements
Rank 1
answered on 15 Jul 2008, 12:31 PM

Yes, I used the AjaxManager's designer and it generated the markup for me.  It looks similar to your example.  Can you see anything wrong here?

23         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"      
24             DefaultLoadingPanelID="RadAjaxLoadingPanel1">     
25             <AjaxSettings>    
26                 <telerik:AjaxSetting AjaxControlID="RadScheduler1">     
27                     <UpdatedControls>    
28                         <telerik:AjaxUpdatedControl ControlID="RadScheduler1"      
29                             LoadingPanelID="RadAjaxLoadingPanel1" />    
30                     </UpdatedControls>    
31                 </telerik:AjaxSetting>    
32             </AjaxSettings>    
33         </telerik:RadAjaxManager>    
 
0
T. Tsonev
Telerik team
answered on 15 Jul 2008, 01:30 PM
Hello Albert,

Currently, only RadScheduler is set to update itself. By adding the setting that I have sent you, scheduler will be updated when the ajaxRequest method is executed (the manager will update the scheduler).

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" 
    DefaultLoadingPanelID="RadAjaxLoadingPanel1"
    <AjaxSettings>     
        <telerik:AjaxSetting AjaxControlID="RadScheduler1"
            <UpdatedControls>     
                <telerik:AjaxUpdatedControl ControlID="RadScheduler1" 
                    LoadingPanelID="RadAjaxLoadingPanel1" />     
            </UpdatedControls> 
        </telerik:AjaxSetting> 
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
            <UpdatedControls>  
                <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />  
            </UpdatedControls>  
        </telerik:AjaxSetting>  
    </AjaxSettings>     
</telerik:RadAjaxManager>

Give this a try to see if it works.

Regards,
Tsvetomir Tsonev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Albert
Top achievements
Rank 1
answered on 15 Jul 2008, 01:44 PM
That makes perfect sense and it must be part of the problem but it still doesn't update.  Do you see anything else?  Or, perhaps you can send a working example I can look at?
0
Albert
Top achievements
Rank 1
answered on 15 Jul 2008, 09:28 PM
Ok, you are 100% correct on this.  I set it via the designer and it works now.  However, you may want to update your documentation.  Take a look at bullet 5 in the help file http://www.telerik.com/help/aspnet-ajax/schedule_howtoreplacingtheeditform.html

It reads:  "In the Property Builder, check the box for your RadScheduler component for both controls that initiate requests and controls that need to be updated. Assign the RadAjaxLoadingPanel as the loading panel when the scheduler updates."

Instead I think it should instead read, "Select the RadAjaxManager for the control that initiates the request and select the RadScheduler for the control that needs to be updated"

Thanks for your help!
Al
0
Simon
Telerik team
answered on 17 Jul 2008, 02:28 PM
Hi Albert,

Thank you for bringing this to our attention.

The issue has been fixed and your Telerik points have been updated for the report.

Kind regards,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
Albert
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Albert
Top achievements
Rank 1
Simon
Telerik team
Share this question
or