TimePicker and javascript

2 posts, 1 answers
  1. Radoslaw
    Radoslaw avatar
    40 posts
    Member since:
    Sep 2007

    Posted 21 Nov 2007 Link to this post

    Is there any possibility to get the reference to TimePicker from the 'sender' argument in javascript? I have a lot of time pickers on my page and i want the time to be changed every 5 minutes (when i use keyboard, not pipup picker). so after value is changed i want to take it, see if the minutes are divided by 5 (0,5,10...). If not, change it.

    Thank You for any help, tips
  2. Answer
    Giuseppe avatar
    2363 posts

    Posted 21 Nov 2007 Link to this post

    Hello Radoslaw,

    If you are using the OnDateSelected client-side event "sender" is the timepicker itself:

    <script type="text/javascript"
    function OnDateSelected(sender, args) 
        // sender is the timepicker 
    <telerik:RadTimePicker ID="RadTimePicker1" runat="server"
        <ClientEvents OnDateSelected="OnDateSelected" /> 

    However, if you would like to use an event of the DateInput, you will need to use the following approach:

    <script type="text/javascript"
    function pageLoad() 
        var timepicker = $find("RadTimePicker1"); 
        timepicker.get_DateInput().OwnerID = timepicker.get_id(); 
    function OnValueChanged(sender, args) 
        // timepicker can be referenced like this 
        var timepicker = $find(sender.OwnerID); 
    <telerik:RadTimePicker ID="RadTimePicker1" runat="server"
            <ClientEvents OnValueChanged="OnValueChanged" /> 

    Hope this helps.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top