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

RadDateTimePicker behaviour...

3 Answers 389 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 2
Mike asked on 04 Jun 2009, 12:00 PM
Hi there,

Just a comment really, when using a rad datetime picker, it might be useful to be able to catch some event based on the date that a user has selected.  

The problem is that with the select/unselect behaviour of the calendar in the datepicker, there is an inbetween event "valuechanged" fired, with the date at that point being "1 January 1980", or datemin, so you can't really attach anything directly to that event without fudging it... 

Now I understand the select/unselect of a calendar is why this behaviour exists, but realistically, when using a datepicker control, WHY would anyone want that inbetween date? Surely we're only ever interested in the date that the user has selected? This feels to me like seeing unecessarily the mechanics of the control?

Would it not be possible to segregate the events into a "real" ValueChanged event which would only fire once the 
transaction (if you like) of changing to mindate and then to the actual date clicked on had completed and then relegate the current ValueChanged to something more accurate like "CalendarSelectionChanged"? 

I think that a datepicker control should allow me to capture what the user has actually selected without having to filter out spurious events.

Incidentally, how DOES one filter out that spurious event when the date selected happens to be the minimum date? Does your control fire valuechanged twice, both times with the same (mindate) value in the Value property?

Kind regards,
Mike

3 Answers, 1 is accepted

Sort by
0
Accepted
Boyko Markov
Telerik team
answered on 05 Jun 2009, 08:09 AM
Hello Mike,

ValueChanged event is fired only when the Value(a DateTime object) is changed. If you set it to a value between MinDate and MaxDate the event will be fired. The event will be fired when you select a value different than the current one. The event will also fire when you select the NullDate (which is in sync with the MinDate by default). I understand that select/unselect of RadCalendar is a behavior which does not fit well in the case of RadDateTimePicker because users shouldn't be allowed to unselect a date, but just select it.
We will consider changing this behavior for the next major release.

Thank you for the feedback. Please contact me again if you have any other questions.

Sincerely yours,
Boyko Markov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
AndreaT
Top achievements
Rank 1
answered on 01 Aug 2012, 10:25 AM
Hi,

as of versione 2011 Q3 the ValueChanged event is also fired when the control looses focus regardeless the real value was changed or not. You can test this simply moving between controls using TAB key without doing anything else: the event is raised and to me it is a bug.

--
kind regards
Andrea

0
Peter
Telerik team
answered on 06 Aug 2012, 06:09 AM
Hello Andrea,

Thank you for contacting us.

We are aware of this issue. It was fixed in our Q1 2012 SP1 release. I cannot propose a workaround for your version because the issue is located deeply in the internal control logic.

I will suggest to upgrade your project to our latest version in order to take advantage of the fix.

I hope that you find this information useful. Do not hesitate to contact us if you have other questions. 

Kind regards,
Peter
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Mike
Top achievements
Rank 2
Answers by
Boyko Markov
Telerik team
AndreaT
Top achievements
Rank 1
Peter
Telerik team
Share this question
or