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

RadDatePicker SharedCalendar Server-Side

3 Answers 111 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
robertw102
Top achievements
Rank 1
robertw102 asked on 21 Jan 2010, 07:50 PM
I've noticed a strange behavior with the RadDatePicker control and setting the SharedCalendar in code. It appears the date pickers forget the shared calendar reference. For example, when the page first loads all the calendars work, but after a post back they don't show the popup calendar.

The way I have my pages setup is like so, I have the shared calendar in my master page and then I set the shared calendar of all my date pickers to this calendar control in my code-behind.

If you could try this out and tell me if you experience the same thing or if I'm doing something wrong.

Thanks

3 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 22 Jan 2010, 07:44 AM
Hello Robert,

From the information provided in this post I noticed that you referenced RadCalendar for ASP .NET AJAX version 2009.3.1314. Could you please confirm that this is the version generating the specified issue?

If this is the case then I would suggest you to open a formal support ticket and send us a small sample project demonstrating the problem. This way we would be able to debug it locally and provide you with more information about the cause of the issue.

Regards,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
robertw102
Top achievements
Rank 1
answered on 25 Jan 2010, 04:02 PM
I just downloaded the latest version of the Telerik controls (the one's you mention) and the issue still occurs. I created a test page, which replicates the issue I'm experiencing.

The ASPX page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %> 
 
<!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></title
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
        <telerik:RadDatePicker ID="dpDatePicker1" runat="server"
        </telerik:RadDatePicker> 
        <asp:Button ID="btnSubmit" runat="server" Text="Submit" /> 
        <telerik:RadCalendar ID="calShared" runat="server"
        </telerik:RadCalendar> 
    </div> 
    </form> 
</body> 
</html> 
 

The Code-Behind:
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
public partial class Test : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!Page.IsPostBack) 
        { 
            dpDatePicker1.SharedCalendar = calShared; 
        } 
    } 
 

So I set the SharedCalendar property in my code-behind. When the page first loads, everything works fine, but after pressing the button, causing a post back to occur the calendar breaks. This appears to be the same thing as the RadWindow issue I posted about before where the properties set in the code-behind are not being held when a post back occurs. If you remove the post back check everything works, just like your examples on the site, which keep setting the SharedCalendar property on every post back.
0
Martin
Telerik team
answered on 27 Jan 2010, 04:18 PM
Hello Robert,

From your code I noticed that you have set the SharedCalendar property on initial page load only. However please note that when set in the code, the shared calendar should be set to the picker on every page load. The following help article demonstrates this approach (the section "Defining a shared popup control at runtime"):

Sharing the Embedded Popup Controls

I hope this helps,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Calendar
Asked by
robertw102
Top achievements
Rank 1
Answers by
Martin
Telerik team
robertw102
Top achievements
Rank 1
Share this question
or