RadDatePicker SharedCalendar Server-Side

4 posts, 0 answers
  1. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 21 Jan 2010 Link to this post

    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
  2. Martin
    Admin
    Martin avatar
    811 posts

    Posted 22 Jan 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 25 Jan 2010 Link to this post

    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.
  5. Martin
    Admin
    Martin avatar
    811 posts

    Posted 27 Jan 2010 Link to this post

    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.
Back to Top