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

How to set the SelectedDate but still display the EmptyMessage on a RadTimePicker

3 Answers 63 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Michael Malone
Top achievements
Rank 1
Michael Malone asked on 12 Dec 2012, 10:14 PM
I have a unique situation. We are developing a Timecard Entry system with "Time In" and "Time Out" pickers for each day of the week. I have attached a screenshot for reference. When a blank timecard initially loads, the time pickers should have an empty message of "Time In" and "Time Out" accordingly. I do this by settings the DateInput.EmptyMessage property. When a user selects the Time In/Out values, the DATE portion of the time picker needs to be the date corresponding to the day of the week. Instead, each time picker's date is always defaulted to TODAY's date. The only way I know to change this default behavior is to manually set the "SelectedDate" property on each time picker for each day of the week but then I lose my EmptyMessage of "Time In" or "Time Out".  My question is, is there a way to set the SelectedDate property but not have it actually be visually "selected" per se? I need the time pickers to display the EmptyMessage when the page loads. But I still need to have full control over which date the control uses when something is selected.

3 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 13 Dec 2012, 11:34 AM
Hello Michael,

You can handle the RadTimePicker's OnDateSelected ClientEvent and to change the Date of the selected date.
http://www.telerik.com/help/aspnet-ajax/calendar-on-date-selected.html

Regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Michael Malone
Top achievements
Rank 1
answered on 19 Dec 2012, 07:16 PM
How do you reset the date for a RadTimePicker in Javascript? I've tried the following inside the OnDateSelected ClientEvent but it doesn't seem to be updating the SelectedDate value when I check it after a postback.

var timePickerIn = $find("<%=tcForm.SatTimeInTimePicker.ClientID %>");
var timeInAdjusted = new Date(y, m, d, h, min);
timePickerIn.set_selectedDate(timeInAdjusted);
0
Vasil
Telerik team
answered on 24 Dec 2012, 01:45 PM
Hi Michael,

This demo shows how to use the set_selectedDate, and it is working correct. Essentially it it the same way as you do it so I am not sure why you are facing an issue. Check the demo's source code and see what is different in your code.
http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/clientapi/defaultcs.aspx

All the best,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Calendar
Asked by
Michael Malone
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Michael Malone
Top achievements
Rank 1
Share this question
or