databind timepicker w/seconds formatting

3 posts, 0 answers
  1. Nimesh
    Nimesh avatar
    24 posts
    Member since:
    Dec 2007

    Posted 26 Jul 2012 Link to this post

    Does anyone hav knowledge on how format a radtimepicker that has been declaratively bound? I would like to show the seconds as well as hours and minutes. Below works, but only displays hours and minutes, not seconds.  Bound to an objectdatasource.
    <telerik:RadTimePicker ID="RadTimePicker1" DbSelectedDate='<%# Bind("StartTime", "{0:T}") %>' ZIndex="30001" runat="server">
                                    <TimeView runat="server" TimeFormat="HH:mm:ss"></TimeView>                            
                                    <DateInput ID="DateInput1" runat="server" DateFormat="hh:mm ttt" DisplayDateFormat="hh:mm ttt">
                                    </DateInput>
                                    </telerik:RadTimePicker>

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

    Posted 26 Jul 2012 Link to this post

    Hi Nimesh,

    Try the following code snippet to show seconds in RadTimePicker.

    ASPX:
    <telerik:RadTimePicker ID="RadTimePicker1"  ZIndex="30001" runat="server" DbSelectedDate='<%# Bind("StartTime", "{0:T}") %>'>
      <TimeView runat="server" TimeFormat="HH:mm:ss">
      </TimeView>
      <DateInput ID="DateInput1" runat="server" DateFormat="HH:mm:ss" DisplayDateFormat="HH:mm:ss">
      </DateInput>
    </telerik:RadTimePicker>

    Hope this helps.

    Regards,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nimesh
    Nimesh avatar
    24 posts
    Member since:
    Dec 2007

    Posted 27 Jul 2012 Link to this post

    Thanks so much Princy. Works perfect. Problem is I have the timepicker in a Formview. I can't seem to reference the control in clientside script. Standard protection level error meaning I'm not refrencing it properly. Any ideas?
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function TimeChanged(sender, eventArgs) {
                    var newDate = eventArgs.get_newDate();
                    var newMinutes = newDate.getMinutes();
                    var remainder = newMinutes % 15;
                    var TimePicker1 = $find("<%=RadTimePicker1.ClientID %>");
                    var TimePicker2 = $find("<%=RadTimePicker2.ClientID %>");
                }   
            </script>
    <asp:FormView ID="FormView1" runat="server" DataKeyNames="CallID" 
                DataSourceID="ObjectDataSource1" >
                <EditItemTemplate>
                    <div style="display:inline-block">
                        <table class="Target3" width="250px" border="0" style="border:none 1px #cccccc" cellpadding="3" cellspacing="0" bordercolor="#cccccc">
                            <tr>
                                <th style="width:75px">
                                Conf Date
                                </th>
                                <td>
                                <telerik:RadDatePicker Width="140px" ID="RadDatePicker1" Style="" MinDate="01/01/2011"
                                MaxDate="12/31/2050" DbSelectedDate='<%# Bind("ConfDate") %>' runat="server">                            
                                </telerik:RadDatePicker>
                                </td>
                            </tr>
                            <tr>
                                <th style="width:75px">
                                Start Time
                                </th>
                                <td>
                                    <telerik:RadTimePicker ID="RadTimePicker1" Width="140px" ClientEvents-OnDateSelected="TimeChanged" DbSelectedDate='<%# Bind("StartTime", "{0:T}") %>' ZIndex="30001" runat="server">
                                    <TimeView ID="TimeView2" runat="server" TimeFormat="hh:mm:ss" Columns="6" Interval="00:10:00"></TimeView>                            
                                    <DateInput ID="DateInput1" runat="server" DateFormat="hh:mm:ss" DisplayDateFormat="hh:mm:ss">
                                    </DateInput>
                                    </telerik:RadTimePicker>
                                </td>
                            </tr>
                            <tr>
                                <th style="width:75px">
                                End Time
                                </th>
                                <td>
                                    <telerik:RadTimePicker ID="RadTimePicker2" Width="140px" ClientEvents-OnDateSelected="TimeChanged" DbSelectedDate='<%# Bind("EndTime", "{0:T}") %>' ZIndex="30001" runat="server">
                                    <TimeView ID="TimeView1" runat="server" TimeFormat="hh:mm:ss" Columns="6" Interval="00:10:00"></TimeView>                            
                                    <DateInput ID="DateInput2" runat="server" DateFormat="hh:mm:ss" DisplayDateFormat="hh:mm:ss">
                                    </DateInput>
                                    </telerik:RadTimePicker>
                                </td>
                            </tr>
    </table>
      
    .... ending formview, edit template etc.
        </telerik:RadCodeBlock>

    Regards, Nimesh
Back to Top