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

[Solved] Setting Interval of TimePicker using JQuery

1 Answer 99 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Camilo Torres
Top achievements
Rank 1
Camilo Torres asked on 09 Nov 2011, 08:29 AM
Hi,

I am using Telerik TimePicker control. When the page loads, the Interval is set to a value from database. But on the same screen I have a text box control where user can specify a different value for Interval. If user changes the value of Interval (say from 30 mins to 15 mins) in text box then on tab out of text box (OnChange event), the Interval of TimePicker should change to the new value.

I have tried to use following code to achieve the same. But it appears that the interval does not change using JQuery. The value of the interval is set to the new value but the TimePicker does not show the time with new interval.

// Telerik IntegerTextBox
<%=  Html.Telerik().IntegerTextBox()
                         .Name("IntervalSelector")
                         .MinValue(0)
                         .MaxValue(60)
                         .Value(Model.TimePickers)
                         .ClientEvents(events => events
                               .OnChange("numericOnChange")
                           )
 %>
 
 // Telerik TimePicker
  <%= Html.Telerik().TimePickerFor(m => m.HStartTime)
                       .Interval(05)
  %>
 
<script type="text/javascript">
 function numericOnChange(e) {
 $('#HStartTime').data('tTimePicker').interval =15;
    }
</script>

Please let us know how this can be achieved.

Thanks in advance!!

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 09 Nov 2011, 10:22 AM
Hello Camilo,

In order to achieve your goal you will need to rebind the list with hours after changing the interval. Check the updated code snippet:

<script type="text/javascript">
 function numericOnChange(e) {
     $('#HStartTime').data('tTimePicker').timeView.interval =15;
     $('#HStartTime').data('tTimePicker').timeView.bind();
 }
</script>

Regards,
Georgi Krustev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Date/Time Pickers
Asked by
Camilo Torres
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or