
Brian Mains
Top achievements
Rank 1
Brian Mains
asked on 08 Jan 2009, 10:14 PM
Hello,
On the client: RadTimePicker.get_selectedDate:
The inner value being evaluated is a string, not a date for some reason, and this is causing me many problems. Any reason why that may be? It errors when it's formatting the date; the code calls getFullYear(), but this throws an exception because it's a string.
Thanks.
On the client: RadTimePicker.get_selectedDate:
The inner value being evaluated is a string, not a date for some reason, and this is causing me many problems. Any reason why that may be? It errors when it's formatting the date; the code calls getFullYear(), but this throws an exception because it's a string.
Thanks.
4 Answers, 1 is accepted
0
Hello Brian Mains,
When you are using RadTimePicker control you cannot get the date as an object, because the purpose of the control is to select only time, not date. That's why if you try to get the calendar on the client-side the method returns null. In this case you can get the selected date and to substring the time from date. The other solution is to use the args parameter passed to the function to get selected value, which is the time.
Here is a code snippet shows this approach:
To get the selected date you need to use RadDatePicker or RadDateTimePicker. In this case you can get the date as an object, when get calendar from one of these controls, you can retrieve the collection of the selected dates.
Below is a code excerpts which describe suggested approach:
I hope this helps.
Sincerely yours,
Georgi Krustev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
When you are using RadTimePicker control you cannot get the date as an object, because the purpose of the control is to select only time, not date. That's why if you try to get the calendar on the client-side the method returns null. In this case you can get the selected date and to substring the time from date. The other solution is to use the args parameter passed to the function to get selected value, which is the time.
Here is a code snippet shows this approach:
function SelectedTime(sender, args) { |
var selectedTime = args.get_newValue(); //will return selected time. |
} |
To get the selected date you need to use RadDatePicker or RadDateTimePicker. In this case you can get the date as an object, when get calendar from one of these controls, you can retrieve the collection of the selected dates.
Below is a code excerpts which describe suggested approach:
function SelectedDate(sender, args) { |
var date = sender.get_calendar().get_selectedDates(); |
} |
I hope this helps.
Sincerely yours,
Georgi Krustev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Brian Mains
Top achievements
Rank 1
answered on 12 Jan 2009, 07:31 PM
Hey,
But the DateSelected event fires and I can access the property get_selectedDate and set_selectedDate properties, via: http://www.telerik.com/help/aspnet-ajax/calendar_clientsideradtimepicker.html. The issue was the value I was assigning to set_selectedDate was a string, so when I next accessed get_selectedDate, it threw that exception. So the input wasn't validated, which caused errors...
But the DateSelected event fires and I can access the property get_selectedDate and set_selectedDate properties, via: http://www.telerik.com/help/aspnet-ajax/calendar_clientsideradtimepicker.html. The issue was the value I was assigning to set_selectedDate was a string, so when I next accessed get_selectedDate, it threw that exception. So the input wasn't validated, which caused errors...
0
Hi Brian,
I'm sorry for the misunderstanding. I reviewed the described issue, and I could not reproduce the problem. I used this JavaScript method in my attempt to recreate this abnormality:
This code will add five days to the selected date, but still there will be no change in the selected time. Indeed the get_selectedDate() method returns Date object and you can apply all defined methods for this Date object.
If the problem persists, I will ask you to open a regular support ticket and send us a working test project that replicates this issue. Thus I will do my best to provide more to-the-point answer/solution for your case.
Best regards,
Georgi Krustev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I'm sorry for the misunderstanding. I reviewed the described issue, and I could not reproduce the problem. I used this JavaScript method in my attempt to recreate this abnormality:
function SetDate(){ |
var myDate = new Date(); |
myDate.setDate(myDate.getDate() + 5); |
$find("RadTimePicker1").set_selectedDate(myDate); |
} |
This code will add five days to the selected date, but still there will be no change in the selected time. Indeed the get_selectedDate() method returns Date object and you can apply all defined methods for this Date object.
If the problem persists, I will ask you to open a regular support ticket and send us a working test project that replicates this issue. Thus I will do my best to provide more to-the-point answer/solution for your case.
Best regards,
Georgi Krustev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Brian Mains
Top achievements
Rank 1
answered on 13 Jan 2009, 04:16 PM
Hey,
Yes, my last post wasn't actually still an issue; it was resolved by converting the string I was working with to a date through Date.parseInvariant (ASP.NET AJAX) did work for me.
Brian
Yes, my last post wasn't actually still an issue; it was resolved by converting the string I was working with to a date through Date.parseInvariant (ASP.NET AJAX) did work for me.
Brian