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

[Bug] RadDateTime Control Requires extra click when selecting a date

5 Answers 105 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Pawz
Top achievements
Rank 1
Pawz asked on 15 Sep 2008, 01:24 AM
There's this odd bug/inconsitency I've been noticing with the latest DateTimePicker control. When you load the form initially, the very first time you click on a DateTimePicker to drop down the calendar and select a date, you must click on the date *twice* before the control will commit the selection.

Every selection after this will be immediately made (only two clicks required - drop down arrow & calendar number).

This feature has already tripped up some of my beta users - is there a way I can eliminate that first extra click?

5 Answers, 1 is accepted

Sort by
0
Boyko Markov
Telerik team
answered on 18 Sep 2008, 02:58 PM
Hi Pawz,

Indeed, this is something we have to fix. There is a workaround for this, which you can use until we fix the problem:

1. Subscribe to the SelectionChanged event of RadDateTimePicker's built in RadCalendar

      (this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar).Calendar.SelectionChanged += new EventHandler(Form1_SelectionChanged);
     
2. Hide the PopUp when a selection has been made.

 void Form1_SelectionChanged(object sender, EventArgs e)
        {
            (this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar).PopupControl.HideControl();
            this.radDateTimePicker1.Value = (this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar).Calendar.SelectedDate;
        }

Please contact me again if there is something I can help with.

Kind regards,
Boyko Markov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mark Davidson
Top achievements
Rank 1
answered on 29 Sep 2008, 09:06 PM
Any update as to when this will be fixed.

I have a form that has 10+ RadDateTimePickers on it and I don't want to create an eventhandler for everyone. I tried to generalize the function like I have for setting the FocusDate of the RadDateTimePickerCalendar.Calendar.FocusedDate, but I haven't had much luck.  What I was trying to do was use the Enter event to create a selectionchanged event handler based on the sender argument. The problem I have is that when I handle the selectionchanged event the sender is RadCalendar which doesn't have the ability as far as I can tell to close the popup. See code below for what I was trying to accomplish before I discovered that the sender was RadCalendar.

private void radDateTimePicker_Enter(object sender, EventArgs e)
{
(((Telerik.WinControls.UI.
RadDateTimePicker)sender).DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar).Calendar.SelectionChanged += new EventHandler(radDateTimePickerCalendar_SelectionChanged);
}

void

radDateTimePickerCalendar_SelectionChanged(object sender, EventArgs e)
{
(((Telerik.WinControls.UI.
RadDateTimePicker)sender).DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar).PopupControl.HideControl();
}

0
Boyko Markov
Telerik team
answered on 02 Oct 2008, 06:49 PM
The issue is in our TO DO list, Mark, and we will do our best to fix it for the Q3 release of RadControls for WinForms - hopefully the resources will permit us to do so. However you can subscribe to only one event handler in a loop and then in the handler you can call in a loop through all datetimepickers in your form to close their popups.


All the best,
Boyko Markov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dipak
Top achievements
Rank 1
answered on 26 Nov 2008, 05:27 PM
I am generating DateTimePicker control at runtime. This code is not working in my project could you please provide me work arrount for this?

Dipak Polra
0
Boyko Markov
Telerik team
answered on 28 Nov 2008, 08:21 AM
Hi Dipak,

In a few days we will release Q3 SP1 and you won't need to write any additional code to hide the calendar popup. However, let me explain the code:

1. The following code hides the popup
(((Telerik.WinControls.UI.RadDateTimePicker)sender).DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar).PopupControl.HideControl();

2. We want the popup to be hidden on calendar's selection change. That is why I subscribe to the SelectionChanged event and call the HideControl method event's handler.

 
Kind regards,
Boyko Markov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Pawz
Top achievements
Rank 1
Answers by
Boyko Markov
Telerik team
Mark Davidson
Top achievements
Rank 1
Dipak
Top achievements
Rank 1
Share this question
or