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

radTimePicker in a user control

6 Answers 139 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Roger asked on 27 Mar 2008, 04:13 AM
Hi,

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

Sort by
0
Roger
Top achievements
Rank 1
answered on 27 Mar 2008, 05:35 AM
Hi again,

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
0
Roger
Top achievements
Rank 1
answered on 27 Mar 2008, 07:25 AM
Hi again,

seems the problem is geting a client side handle of the timepicker object.

No matter what I do (
var radTimePicker = <%= RadTimePicker1.ClientID %>;
var radTimePicker = find$("<%= RadTimePicker1.ClientID %>");)

the variable comes back as empty.

The examples work fine but my simple test page cannot get hold of the RadTimePicker1object.

Any ideas???

Roger
0
plamen
Top achievements
Rank 1
answered on 27 Mar 2008, 07:52 AM
hi :)


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 />

0
Roger
Top achievements
Rank 1
answered on 27 Mar 2008, 10:41 PM
Thanks John,

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
0
Roger
Top achievements
Rank 1
answered on 27 Mar 2008, 11:16 PM

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
0
Yavor
Telerik team
answered on 28 Mar 2008, 07:43 AM
Hello 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
Tags
Calendar
Asked by
Roger
Top achievements
Rank 1
Answers by
Roger
Top achievements
Rank 1
plamen
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or