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

RadDatePicker and RadTimePicker to use same date

3 Answers 191 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 30 Apr 2010, 07:13 PM
Hello,

I have a RadDatePicker and two RadTimePickers on a page.  Is there any built-in way to link the selected date of the RadTimePickers to the selected date of the RadDatePicker so when they go to chose the time from the RadTimePicker it doens't change the date back to today's date?

I know that I can get the selected date from the RadDatePicker on autopostback and then set the selected date on the RadTimePickers to that date.  But then when you chose the time from the RadTimePicker it sets the date back to today's date.

Thanks.

3 Answers, 1 is accepted

Sort by
0
robertw102
Top achievements
Rank 1
answered on 30 Apr 2010, 08:52 PM
Why don't you just use two RadDateTimePicker controls. That way it will retain the selected date. Or when you save you could create new datetime objects with the selected date like so:

DateTime selectedDate = RadDatePicker.SelectedDate.Value; 
DateTime selectDateTime1 = new DateTime(selectedDate.Year, selectedDate.Month, selectedDate.Day, 
RadTimePicker1.SelectedDate.Value.Hour, RadTimePicker1.SelectedDate.Value.Minute,0); 
 
// perform code to save selected date and times 

I hope that helps.
0
Stephen
Top achievements
Rank 1
answered on 30 Apr 2010, 09:04 PM
Thank you for the reply.

I need to only have one date appear so the first option is out.  The second method is what I am doing, just maipulating the info before I save.  I just thought there might be a way to automatically hook the date of the timepicker to the date of a datepicker, maybe through a property.
0
Daniel
Telerik team
answered on 06 May 2010, 10:31 AM
Hello Stephen,

There is no built-in functionality to link the dates in such manner. Unfortunately, Robert's suggestion is the only feasible option I can think of for this scenario.

Let me know if you need more information.

Best regards,
Daniel
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.
Tags
Calendar
Asked by
Stephen
Top achievements
Rank 1
Answers by
robertw102
Top achievements
Rank 1
Stephen
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or