We are using RadScheduler and RadAjaxManager and it works for the first AJAX request (eg, change month) but the second request does nothing, no error message, no change to display at all.
This is a little complex to explain but the specifics of the problem are that the website it is used on is a content management system that does not have actual ASPX pages for content pages, instead it uses ASP.NET 4.0 page routing. A routing rule sends the page request to a specific ASPX page which works out the URL requested and displays the requested content.
The problem we are having only occurs on pages requested this way. Our RadScheduler/RadAjaxManager are in an ASCX custom control and if I add that control directly to an ASPX file and request it directly the problem does not happen.
This is the code from our ASCX control:
And the code behind:
Any idea why this problem is happening only in these circumstances?
This is a little complex to explain but the specifics of the problem are that the website it is used on is a content management system that does not have actual ASPX pages for content pages, instead it uses ASP.NET 4.0 page routing. A routing rule sends the page request to a specific ASPX page which works out the URL requested and displays the requested content.
The problem we are having only occurs on pages requested this way. Our RadScheduler/RadAjaxManager are in an ASCX custom control and if I add that control directly to an ASPX file and request it directly the problem does not happen.
This is the code from our ASCX control:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WsiEventCalendar.ascx.cs" Inherits="STAFF.PageTemplates.WsiEventCalendar" %> <%@ Register TagPrefix="scheduler" TagName="AdvancedForm" Src="AdvancedForm.ascx" %> <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> <asp:Panel ID="pnlError" runat="server" Visible="false"> Event not found. </asp:Panel> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> <Scripts> <asp:ScriptReference Path="AdvancedForm.js" /> <%--Needed for JavaScript IntelliSense in VS2010--%> <%--For VS2008 replace RadScriptManager with ScriptManager--%> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" /> </Scripts> </telerik:RadScriptManager> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" > <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadScheduler1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> <script type="text/javascript"> //<![CDATA[ // Dictionary containing the advanced template client object // for a given RadScheduler instance (the control ID is used as key). var schedulerTemplates = {}; function schedulerFormCreated(scheduler, eventArgs) { // Create a client-side object only for the advanced templates var mode = eventArgs.get_mode(); if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert || mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) { // Initialize the client-side object for the advanced form var formElement = eventArgs.get_formElement(); var templateKey = scheduler.get_id() + "_" + mode; var advancedTemplate = schedulerTemplates[templateKey]; if (!advancedTemplate) { // Initialize the template for this RadScheduler instance // and cache it in the schedulerTemplates dictionary var schedulerElement = scheduler.get_element(); var isModal = scheduler.get_advancedFormSettings().modal; advancedTemplate = new window.SchedulerAdvancedTemplate(schedulerElement, formElement, isModal); advancedTemplate.initialize(); schedulerTemplates[templateKey] = advancedTemplate; // Remove the template object from the dictionary on dispose. scheduler.add_disposing(function () { schedulerTemplates[templateKey] = null; }); } // Are we using Web Service data binding? if (!scheduler.get_webServiceSettings().get_isEmpty()) { // Populate the form with the appointment data var apt = eventArgs.get_appointment(); var isInsert = mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert; advancedTemplate.populate(apt, isInsert); } } } //]]> </script> <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> function Export(sender, e) { $find("<%= RadAjaxManager1.ClientID %>").__doPostBack(sender.name, ""); } </script> </telerik:RadCodeBlock> <style type="text/css"> .RadScheduler .rsExportButton { position: absolute; bottom: 0; right: 0; border: 0; height: 24px; width: 24px; background: url('/images/icons/Outlook.gif') no-repeat center center; } .RadScheduler .rsAllDayRow .rsExportButton { right: 20px; height: 16px; width: 16px; background: url('/images/icons/SmallOutlook.gif'); } </style> <asp:Panel ID="pnlForm" runat="server"> <telerik:RadScheduler ID="RadScheduler1" runat="server" SelectedView="WeekView" TimeZoneOffset="00:00:00" DayStartTime="08:00:00" DayEndTime="18:00:00" OnAppointmentCreated="RadScheduler1_AppointmentCreated" ProviderName="SchedulerData" EnableDescriptionField="True" AppointmentStyleMode="Default" OnAppointmentCommand="RadScheduler1_AppointmentCommand" OnClientFormCreated="schedulerFormCreated" CustomAttributeNames="AppointmentColor,EventLocation"> <AdvancedForm Modal="true" /> <Reminders Enabled="false" /> <AppointmentTemplate> <div class="rsAptSubject"> <%# Eval("Subject") %> </div> <%# Eval("Description") %> <div style="text-align: right;"> <asp:Button runat="server" ID="Button1" CssClass="rsExportButton" ToolTip="Export to iCalendar" CommandName="Export" OnClientClick="Export(this, event); return false;" Style="cursor: pointer; cursor: hand;" /> </div> </AppointmentTemplate> <AdvancedEditTemplate> <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>' Description='<%# Bind("Description") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' EventLocation='<%# Bind("EventLocation") %>' AppointmentColor='<%# Bind("AppointmentColor") %>' AudienceID='<%# Bind("Audience") %>' CategoryID='<%# Bind("Category") %>' /> </AdvancedEditTemplate> <AdvancedInsertTemplate> <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>' Start='<%# Bind("Start") %>' End='<%# Bind("End") %>' Description='<%# Bind("Description") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' EventLocation='<%# Bind("EventLocation") %>' AppointmentColor='<%# Bind("AppointmentColor") %>' AudienceID='<%# Bind("Audience") %>' CategoryID='<%# Bind("Category") %>' /> </AdvancedInsertTemplate> <TimelineView UserSelectable="false" /> <TimeSlotContextMenuSettings EnableDefault="true" /> <AppointmentContextMenuSettings EnableDefault="true" /> </telerik:RadScheduler> </asp:Panel>And the code behind:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Telerik.Web.UI; using System.Text; using SharedDataAccess; namespace STAFF.PageTemplates { public partial class WsiEventCalendar : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e) { e.Appointment.ToolTip = e.Appointment.Subject + ": " + e.Appointment.Description; //showing the recurring icons if (e.Appointment.RecurrenceState == RecurrenceState.Master || e.Appointment.RecurrenceState == RecurrenceState.Occurrence) { Panel recurrenceStateDiv = new Panel(); recurrenceStateDiv.CssClass = "rsAptRecurrence"; e.Container.Controls.AddAt(0, recurrenceStateDiv); } if (e.Appointment.RecurrenceState == RecurrenceState.Exception) { Panel recurrenceStateDiv = new Panel(); recurrenceStateDiv.CssClass = "rsAptRecurrenceException"; e.Container.Controls.AddAt(0, recurrenceStateDiv); } } protected void RadScheduler1_AppointmentCommand(object sender, AppointmentCommandEventArgs e) { if (e.CommandName == "Export") { WriteCalendar(RadScheduler.ExportToICalendar(e.Container.Appointment)); } } private void WriteCalendar(string data) { HttpResponse response = Page.Response; response.Clear(); response.Buffer = true; response.ContentType = "text/calendar"; response.ContentEncoding = Encoding.UTF8; response.Charset = "utf-8"; response.AddHeader("Content-Disposition", "attachment;filename=\"WsiEventExport.ics\""); response.Write(data); response.End(); } } }Any idea why this problem is happening only in these circumstances?