2 RadDateTimePicker controls

4 posts, 0 answers
  1. Ilya
    Ilya avatar
    67 posts
    Member since:
    Jul 2012

    Posted 12 Oct 2011 Link to this post

    I have 2 RadDateTimePicker controls on the page and after user changes time on the first control I want to set another control to display time shown in 1st control (and plus 30 minutes). I've tried using <ClientEvents OnDateSelected="changeEndDate" /> and this javascript but it does not seem to work. Both controls are located inside of an AdvancedInsertTemplate of RadScheduler. 

    function changeEndDate(sender, eventArgs) {
          var endDate = $telerik.$("[id$='EndInput']");
          var newDate = eventArgs.get_newValue();
          endDate.set_selectedDate(newDate);
    }

    What am I doing wrong? Thanks
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 17 Oct 2011 Link to this post

    Hi Ilya,

    Please try to use the following approach:
    <script type="text/javascript">
        function DateSelected(sender, eventArgs) {
            var datetimepicker2 = $find("<%= RDTP2.ClientID %>");
            debugger;
            var date = sender.get_selectedDate();
            date.setMinutes(date.getMinutes() + 30);
            datetimepicker2.set_selectedDate(date);
     
        }
    </script>
    <telerik:RadDateTimePicker ID="RDTP1" runat="server">
        <ClientEvents OnDateSelected="DateSelected" />
    </telerik:RadDateTimePicker>
    <telerik:RadDateTimePicker ID="RDTP2" runat="server">
    </telerik:RadDateTimePicker>

    Give this a try and let me know if it helps.

    Regards,
    Maria Ilieva
    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 RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. Ilya
    Ilya avatar
    67 posts
    Member since:
    Jul 2012

    Posted 17 Oct 2011 Link to this post

    Hi Maria,

    The problem is that both RadDateTimePickers are located inside of AdvancedEditTemplate of RadScheduler and I am having problems finding the EndInput (Appointment End field). I've used var endDate = $telerik.$("[id$='_EndInput']"); and still can't find it.
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 20 Oct 2011 Link to this post

    Hi Ilya,

    Please try using the approaches provided in the following help topic to access the controls in the AdvancedEditTemplate and let me know if this helps.

    Regards,
    Maria Ilieva
    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 RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top