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

Shared Calender with RadAjaxManager Fails after Postback

1 Answer 85 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
TheLostLeaf
Top achievements
Rank 2
TheLostLeaf asked on 03 Mar 2011, 08:24 PM
Hi,

I've had this problem for a while and have not found a solution. When using a Shared Calender with the RadAjaxManager, the pop-up only works the 1st time. Here is the simplest implementation of the example.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--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"></telerik:RadAjaxManager>
    <div id="divContent" runat="server">
        <telerik:RadCalendar ID="RadCalendar1" Runat="server"></telerik:RadCalendar>
    </div>
    </form>
</body>
</html>
using System;
using System.Drawing;
using Telerik.Web.UI;
  
public partial class Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadDatesShared();
    }
  
    void LoadDatesShared()
    {
        for (int i = 0; i < 10;i++ )
        {
            RadDatePicker rdp = new RadDatePicker();
            rdp.SharedCalendar = RadCalendar1;
            rdp.AutoPostBack = true;
            rdp.ID = "rdp" + i.ToString();
            rdp.SelectedDateChanged += new Telerik.Web.UI.Calendar.SelectedDateChangedEventHandler(rdp_SelectedDateChanged);
            divContent.Controls.Add(rdp);
            RadAjaxManager1.AjaxSettings.AddAjaxSetting(rdp, rdp);
        }
    }
  
    void rdp_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
    {
        ((RadDatePicker)sender).BackColor = Color.LightGreen;
    }
  
}

Thanks !

1 Answer, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 09 Mar 2011, 10:00 AM
Hello,

When you are using shared calendars with AJAX you need to make sure that each picker updates itself, all other pickers and the shared calendar. In your case only the first condition is fulfilled. This is because the client states of all pickers should be refreshed when they are sharing a calendar in order for them to be able to find the client object of the control.

Best wishes,
Tsvetina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Calendar
Asked by
TheLostLeaf
Top achievements
Rank 2
Answers by
Tsvetina
Telerik team
Share this question
or