RadDatePicker SelectionChanged event ?

7 posts, 0 answers
  1. Marjeta Segrec
    Marjeta Segrec avatar
    18 posts
    Member since:
    May 2006

    Posted 30 Mar 2009 Link to this post

    Hello.

    How can stop SelectionChanged Event when Loading Page - is this bug ?
    As you can see in code below the Handler for SelectionChanged is added after RadDatePicker1.SelectedDate is setted.

    Partial Public Class Page  
        Inherits UserControl  
     
        Public Sub New()  
            InitializeComponent()  
     
            Me.RadDatePicker1.SelectedDate = Date.Now  
     
            AddHandler RadDatePicker1.SelectionChanged, AddressOf OnRadDatePickerSelectionChanged  
        End Sub  
     
        Private Sub OnRadDatePickerSelectionChanged(ByVal sender As Object, ByVal e As Telerik.Windows.Controls.SelectionChangedEventArgs)  
            MessageBox.Show("OnRadDatePickerSelectionChanged")  
        End Sub  
     
    End Class 

    Thanks for your answer.
  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 31 Mar 2009 Link to this post

    Hello Marjeta,

    This indeed is not the expected behavior.

    It is due to the fact that the SelectionChanged event arises not from the DatePicker itself but from the Calendar that is in its template (thus the DatePicker reuses a lot of functionality from the Calendar).

    When the template is applied (on page loading) the calendar binds to the properties of the DatePicker, and the selection changed event is fired, initiated by the calendar.

    Thank you for bringing our attention to this, I have updated your telerik points.

    We will look into this, but I am not sure if the fix will make it in time for the SP1.

    In the meantime, unfortunately I cannot offer a workaround for this.

    I hope that this behavior will not be a show-stopper for you. If it is, please come back to us and we will offer suggestions for your particular scenario or send you a hotfix once it is ready.

    Sincerely yours,
    Miroslav
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. Marjeta Segrec
    Marjeta Segrec avatar
    18 posts
    Member since:
    May 2006

    Posted 31 Mar 2009 Link to this post

    Hello.

    This is the big problem for my application because when user edit record in page then this event is fired and produces the event like Data is changed - so user can not close the page without press the Save button for nothing.

    I will appreciated if you can find temporary solution for this.

    Thanks.
  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 02 Apr 2009 Link to this post

    Hello Marjeta,

    Unfortunately I could not find a generic fix for the problem. I noticed that if the DatePicker is part of a ContentTemplate and only the DataContext is changed, the event will fire. For example this will happen if you have a TabControl with templated items. (Similarly a master-details view). What happens is that when the DataContext is changed the binding changes the value of the DatePicker and the selection event fires.

    This is expected, since the value does actually change. Could you please ignore the first event after data context change?

    Also, the event fires when the control is first loaded and is bound. But then also the value is actually changed. The problem really is that the event does not fire right away, but only after the control is loaded. Again, could you please ignore the first event after the control has loaded.

    Note that the SelectionChanged event is a routed event and can be canceled at any point along its route. (I.e. if you handle the event at a parent level, you can cancel it before it reaches the business-logic handlers.)

    Again, sorry that we could not come up with a solution quickly. We will look into the problem of the late event firing, but unfortunately the behavior when the DataContext is changed is expected. 

    Sincerely yours,
    Miroslav
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  6. Marjeta Segrec
    Marjeta Segrec avatar
    18 posts
    Member since:
    May 2006

    Posted 02 Apr 2009 Link to this post

    Hello.

    Thanks for your answer and efort. I will catch the first SelectionChanged event on Page load and ignore them.
  7. Ian
    Ian avatar
    29 posts
    Member since:
    Jun 2009

    Posted 02 Nov 2010 Link to this post

    I am using 2010.2.812.1040 version of your control suite, and experiencing the same problems still. Any idea when is this going to be fixed? 
  8. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 05 Nov 2010 Link to this post

    Hi Ian,

    We have made some big changes regarding the Date/Time pickers. So as a first step you have to use the SelectedValue instead the SelectedDate property. Give it a try a feel free to inform us in case of problem appearing.

    Sincerely yours,
    Kaloyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner