RadDateTimePicker synchronisation

3 posts, 0 answers
  1. Yoan
    Yoan avatar
    2 posts
    Member since:
    Jan 2012

    Posted 18 Feb 2014 Link to this post

    Hi,
    Using a Radgrid which have 2 dates column
    When in edit mode on a row, i show 2 RadDateTimePicker for each date column :

    <telerik:GridBoundColumn DataField="ACT_DATEFROM" HeaderText="Date" UniqueName="DateDebut" ReadOnly="true" HeaderStyle-Width="120" />
                        <telerik:GridTemplateColumn UniqueName="DateDebutTp" Display="true" HeaderText="De" DataField="ACT_DATEFROM" HeaderStyle-Width="10" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
    <ItemTemplate>
    <asp:Label runat="server" />
    </ItemTemplate>
    <EditItemTemplate>
    <telerik:RadDateTimePicker runat="server" ID="rdtpDebut" ToolTip="Date/heure de début" TimeView-StartTime="11:00:00" TimeView-EndTime="22:00:00" TimeView-Interval="00:15:00" Calendar-FirstDayOfWeek="Monday" >
                                    <ClientEvents OnDateSelected="DateSelected" />
    </telerik:RadDateTimePicker>
    </EditItemTemplate>
    </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="DateFinTp" Display="true" HeaderText="A" DataField="ACT_DATETO" HeaderStyle-Width="10" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
    <ItemTemplate>
    <asp:Label runat="server" />
    </ItemTemplate>
    <EditItemTemplate>
    <telerik:RadDateTimePicker runat="server" ID="rdtpFin" ToolTip="Date/heure de fin" TimeView-StartTime="11:00:00" TimeView-EndTime="22:00:00" TimeView-Interval="00:15:00" Calendar-FirstDayOfWeek="Monday" />
    </EditItemTemplate>
    </telerik:GridTemplateColumn>

    What i want to do is to synchronise the second RadDateTimePicker named rdtpFin with the first RadDateTimePicker rdtpDebut => when i select a date in the first, i want the date to be automaticaly put in the second
    I tried with javascript events OnDateSelected, but in the javascript function, i can't find/access the second RadDateTimePicker, searching it by id...
    How can i do that ? 
    Thanks
    yoan








  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Feb 2014 in reply to Yoan Link to this post

    Hi Yoan,

    Please try the following JavaScript which works fine at my end.

    JavaScript:
    <script type="text/javascript">
        function DateSelected(sender, args) {
            var Timepicker1 = sender.get_id();
            //Since both the RadDateTimePicker are in the same row
            //they have similar ClientIDs
            var TimepickerID = Timepicker1.replace("rdtpDebut", "rdtpFin");
            var TimePicker2 = $get(TimepickerID);
            TimePicker2.control.set_selectedDate(args.get_newDate());
        }
    </script>

    Thanks,
    Princy. 
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Yoan
    Yoan avatar
    2 posts
    Member since:
    Jan 2012

    Posted 19 Feb 2014 in reply to Princy Link to this post

    works fine !!!!!! Thanks a lot !
Back to Top