SelectedDateChanged firing twice

5 posts, 0 answers
  1. Chris
    Chris avatar
    43 posts
    Member since:
    Aug 2008

    Posted 12 Sep 2008 Link to this post

    Hi,

    I'm using the Prometheus version of your controls, particularly version 2007.3.1314.20, and for some reason the SelectedDateChanged event of the radDatePicker is firing twice.

    This is my html code:

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="TelerikCalendarTest._Default" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <!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>Untitled Page</title> 
    </head> 
    <body> 
        <form id="form1" runat="server"
             
        <div> 
        <telerik:RadScriptManager ID="tsmScriptManager" runat="server" EnablePartialRendering="true" /> 
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"
                <AjaxSettings> 
                    <telerik:AjaxSetting> 
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="test" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting> 
                </AjaxSettings> 
            </telerik:RadAjaxManager> 
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" 
                Width="75px"
                <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' 
                    style="border: 0px;" /> 
            </telerik:RadAjaxLoadingPanel> 
      
        <telerik:RadDatePicker ID="test" runat="server" AutoPostBack="true"></telerik:RadDatePicker> 
        </div> 
        </form> 
         
    </body> 
    </html> 

    And this is the source code:

    Imports Telerik.Web.UI 
    Imports System.Collections.Generic 
     
     
     
    Partial Public Class _Default 
        Inherits System.Web.UI.Page 
     
        Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load 
             
     
        End Sub 
     
        Private Sub test_SelectedDateChanged(ByVal sender As ObjectByVal e As Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs) Handles test.SelectedDateChanged 
     
        End Sub 
    End Class 

    So I put in a break point for the SelectedDateChanged event and it's always firing off twice, and in the big project I'm working on that makes some things not work as expected.  Do you guys know why this is happening?
  2. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 15 Sep 2008 Link to this post

    Hi Chris,

    The code seems to be correct and I'm afraid I don't remember such a problem reported/fixed so far. I tried that with the latest Q2 2008 Service Pack version labeled 2008.2.826, but could not reproduce the described issue as well.

    Just a quick question though, do you run that AjaxSetting this way or do you have the DatePicker set as AJAX initiator as well? Can you try adding RadDatePicker -> RadDatePicker AJAX setting instead and see whether that causes different control behavior? The AJAX setting should look like this:

                    <telerik:AjaxSetting AjaxControlID="test">  
                        <UpdatedControls>  
                            <telerik:AjaxUpdatedControl ControlID="test" />  
                        </UpdatedControls>  
                    </telerik:AjaxSetting>  
     


    Additionally, is the event fired twice when you remove the RadAjaxManager or simply disable it temporary (set EnableAJAX false)?

    Kind regards,
    Konstantin Petkov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Chris
    Chris avatar
    43 posts
    Member since:
    Aug 2008

    Posted 15 Sep 2008 Link to this post

    It fires twice with and without the Script Manager.  I also tried setting up the AJAX settings like you described and still no luck.  Could it have anything to do with me setting the autopostback property?  I need to set that because the calendar interacts with another control.
  4. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 16 Sep 2008 Link to this post

    Hello Chris,

    You definitely need to turn on the AutoPostBack to be able to trigger an AJAX request. RadAjax controls simply converts all the regular postbacks into AJAX requests.

    Please find my test page attached. If the events is fired twice with this page as well, it might be an issue with the old version of Telerik.Web.UI.dll.

    Sincerely yours,
    Konstantin Petkov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Chris
    Chris avatar
    43 posts
    Member since:
    Aug 2008

    Posted 16 Sep 2008 Link to this post

    Yeah, it's still firing twice.  I'll have to wait to use the control when I get a newer version I guess.  Thanks for the help though.
Back to Top