OnSelectedDateChanged event of RadDatePicker(Prometheus version) fires twice

3 posts, 0 answers
  1. Raj Nemani
    Raj Nemani avatar
    20 posts
    Member since:
    Sep 2007

    Posted 04 Feb 2008 Link to this post

    Hello,
    OnSelectedDateChanged event of RadDatePicker(Prometheus) version control fires twice.  I have attached the code from a test project I have created to demonstrate the issue.  I cannot attach a file to the post so I am pasting the code here!.

    Default.aspx:
    ----------------------------

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestRadCalendarPrometheus._Default" %> 
     
    <%@ Register tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"  %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <script runat="server">  
    </script> 
     
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head id="Head1" runat="server">  
        <title>UpdatePanel Example</title> 
        <style type="text/css">  
        body {  
            font-family: Lucida Sans Unicode;  
            font-size: 10pt;  
        }  
        button {  
            font-family: tahoma;  
            font-size: 8pt;  
        }  
        </style> 
          
     
          
          
    </head> 
    <body> 
          <script type="text/javascript">  
                function pageLoad(sender, args){  
                        UpdateSpan();  
                    }  
                function TogglePopUp(){  
                   var datePicker = $find("<%= rdpSelectDate.ClientID %>");  
                    var span = document.getElementById("dateSelector");  
                    var dimSpan = datePicker.GetElementDimensions(span);  
                    var position = datePicker.GetElementPosition(span);  
                      
                    datePicker.ShowPopup(position.x + dimSpan.width - 142, position.y + dimSpan.height);  
                }  
                 
                function UpdateSpan(){  
                    var datePicker = $find("<%= rdpSelectDate.ClientID %>");  
                    var date = datePicker.GetDate();  
                    if (datePicker.IsEmpty())  
                     { date = new Date(); }  
                    var strtDate = new Date(date);  
                    var endDate = new Date(date.setDate(date.getDate() + 6));  
                    var spn = document.getElementById("week");  
                    spn.innerText = strtDate.format("ddd, M/d/yyyy");// + " - " + endDate.format("ddd, M/d/yyyy");  
                }  
                  
                  function OnDateSelected(sender, e){  
                    if (e.get_NewDate() != null){  
                       UpdateSpan();  
                     }  
                }  
                function MoveSelectedDate(numDays){  
                    var datePicker = $find("<%= rdpSelectDate.ClientID %>");  
                    var date = datePicker.GetDate();  
                    if (datePicker.IsEmpty())  
                     { date = new Date(); }  
                    date.setDate(date.getDate() + numDays);  
                    datePicker.SetDate(date);  
                }  
                  
                function OnDayRender(calendarInstance, args){  
                    var date = new Date(args._date[0], args._date[1] - 1, args._date[2]);  
                    var minDate = new Date(calendarInstance.GetRangeMinDate()[0], calendarInstance.GetRangeMinDate()[1] - 1, calendarInstance.GetRangeMinDate()[2]);  
                    if (date < minDate){  
                        args._cell.title = "Dates prior to 6/15/2003 cannot be selected.";  
                        return;  
                    }  
                      
                      
                }  
                 
     
        </script> 
        <form id="form1" runat="server">  
                    <telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableScriptCombine="true" ScriptMode="Auto">  
        </telerik:RadScriptManager> 
     
             <div style="margin-top:5px">  
            <span class="RundownLabelText">Date:&nbsp;</span> 
            <span id="dateSelector">  
                <span id="slctdwk" title="Day Selection" onclick="TogglePopUp();">  
                    <span id="week" class="DropDownListText"></span> 
                    <img id="dtpckr" alt="Calendar" src="images/calbutcon.jpg" /> 
                    <img id="dwnarrw" src="images/downbutcon.jpg" alt=""/>  
                </span> 
            </span> 
        <telerik:RadDatePicker ID="rdpSelectDate" runat="server" SharedCalendarID="RadCalendar1"    
          OnSelectedDateChanged"rdpSelectDate_SelectedDateChanged" AutoPostBack="true" > 
            <DateInput ID="DateInput1" runat="server" ReadOnly="true" style="display:none;"></DateInput> 
            <ClientEvents OnDateSelected="OnDateSelected"/>     
            <DatePopupButton style="display:none;" /> 
        </telerik:RadDatePicker> 
        <telerik:RadCalendar ID="RadCalendar1" runat="server" EnableMultiSelect="true" UseColumnHeadersAsSelectors="false" ShowRowHeaders="false" FirstDayOfWeek="Monday" Skin="WebBlue"    
            RangeMinDate="6/16/2003" NavigationNextToolTip="" NavigationPrevToolTip="">  
            <ClientEvents OnDayRender="OnDayRender" /> 
        </telerik:RadCalendar> 
        </div>    
                  
        </form> 
    </body> 
    </html> 
     
    Default.aspx.cs
    using System;  
    using System.Data;  
    using System.Configuration;  
    using System.Collections;  
    using System.Web;  
    using System.Web.Security;  
    using System.Web.UI;  
    using System.Web.UI.WebControls;  
    using System.Web.UI.WebControls.WebParts;  
    using System.Web.UI.HtmlControls;  
    using Telerik.Web.UI.Calendar;  
     
    namespace TestRadCalendarPrometheus  
    {  
        public partial class _Default : System.Web.UI.Page  
        {  
            protected void Page_Load(object sender, EventArgs e)  
            {  
            }  
     
     
            protected void rdpSelectDate_SelectedDateChanged(object sender, SelectedDateChangedEventArgs e)  
            {  
                Session["ListDate"] = rdpSelectDate.SelectedDate.Value;  
            }  
        }  
    }  
     
    I am using Telerik.Web.UI dll with version # 2007.3.1314.20
    System.Web.Extensions Dll verison # 1.0.61025.0.
    I am not copying the web.config as I think it is unnecessary but let me know if you need it.
    Put a break point in the OnSelectedDateChanged event handler and notice how it will break twice of a singe click on the calendar.

    Your help is appreciated

    Thanks
    Raj
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 06 Feb 2008 Link to this post

    Hi Raj,

    I was able to test locally reduced version of your code, due to missing resources. My test did not show the described problem and the event is fired only once.
    If it is convenient, could you please open a regular support ticket and send us a sample runnable project so we could investigate further.

    Best wishes,
    Maria Ilieva
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Raj Nemani
    Raj Nemani avatar
    20 posts
    Member since:
    Sep 2007

    Posted 06 Feb 2008 Link to this post

    Submitted ticketd ID : 120531
    Also attached a project to the ticket
Back to Top