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

databind timepicker w/seconds formatting

2 Answers 102 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Nimesh
Top achievements
Rank 1
Nimesh asked on 27 Jul 2012, 02:12 AM
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 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Jul 2012, 04:01 AM
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.
0
Nimesh
Top achievements
Rank 1
answered on 27 Jul 2012, 02:06 PM
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
Tags
Calendar
Asked by
Nimesh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Nimesh
Top achievements
Rank 1
Share this question
or