I'm using 2 radTimePicker's in a user control and want to use javascript to access the controls ie when 1 control timer is set it then clears the other timer timer.
Using the doco I did it this way & wrote the script in the control:
var
radTimeOut = find$(<%= RadTimePickerOut.ClientID %>);
function ClearOutTime(sender, e){
//used by timerIN
radTimeOut.clear();
}
ClearOutTime function is used by the first timer.
However I'm getting javascript errors on the page & am thinking that when the user control gets renderd in the web page I'm losing the clientID.....any ideas??
I can access dates from the arguments passed to the function so that part is working.
Regards
Roger
6 Answers, 1 is accepted
have since found out that the control is not being referenced in the javascript. Well the clientid is being returned to the variable but when I try an look at the variable
alert(!radTimerOut) I get true...which means javascript can't access the control.
I have taken the timer controls out of the user contol and put them on a normal web page so it's not the user control.
Also the dll version of radInput is 2.1.1.0...is this OK
Regards
Roger
seems the problem is geting a client side handle of the timepicker object.
No matter what I do (
the variable comes back as empty.
The examples work fine but my simple test page cannot get hold of the RadTimePicker1object.
Any ideas???
Roger
RadInput components provide rich API allowing the developer to control the client-side behavior.
Getting the client-side object
All the API methods are accessible via the registered JavaScript objects for each control (RadTextBox, RadNumreicTextBox etc.)
Here is an example:
<script type="text/javascript"> |
var dateInput = window["<%= RadDateInput1.ClientID %>"]; |
var date = dateInput.GetDate(); |
</script> |
Regards...
<John:Peel />
however the help file for rad calendar, radTimePicker says:
Getting/Setting the time client-side
RadTimeView exposes a rich client-side API that allows you to control its behavior. You can manipulate the time selection by using the GetDate() / SetDate() methods:
JavaScript |
|
---|---|
var radTimePicker = <%= RadTimePicker1.ClientID %>;
var timeView = radTimePicker.GetTimeView(); var time = timeView.GetDate(); |
You method still did not produce a client side object even though I appreciate the help.
Anyone else out there with any suggestions....I now have 1 timer on the page and cannot get a client-side handle on the timer object although the client side event "OnClientTimeSelected" works and I can get a handle through the e and sender objects.
Regards
Roger
Hi,
FOUND the problem:
The help file API call states:
Getting/Setting the time client-side
RadTimeView exposes a rich client-side API that allows you to control its behavior. You can manipulate the time selection by using the GetDate() / SetDate() methods:
JavaScript | Copy Code |
---|---|
var radTimePicker = <%= RadTimePicker1.ClientID %>;
var timeView = radTimePicker.GetTimeView(); var time = timeView.GetDate(); |
Notice the function is GETDATE....it should be GETTIME (or GetTime in java case sensitive speak).
Error in the doco
Regards
Roger
Thank you for bringing this discrepancy to our attention.
I have already corrected it, and it is reflected in the documentation.
Your Telerik points have been updated, as a token of gratitude.
All the best,
Yavor
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center