Setting time of RadDateTimePicker

4 posts, 0 answers
  1. Karl Wilkens
    Karl Wilkens avatar
    206 posts
    Member since:
    Oct 2012

    Posted 02 Aug 2011 Link to this post

    Hi, we are scratching our heads on how to set the time. The value in the database (StartTime) is

    2011-07-22 07:00:00.000

    and our dateTimePicker looks like this

     <telerik:RadDateTimePicker ID="RadDateTimePicker3" runat="server" Culture="English (United States)" DbSelectedDate='<%# Bind("StartTime") %>'  >
                                     <DateInput ID="DateInput3" runat="server" />

    But it always displays 12:00 AM in the time picker. I looked all over the support forums and there are many many examples for the timepicker itself, but nothing all that clear on raddateTimePicker. If anyone can help, that would be greatly appreciated. Thanks!
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Aug 2011 Link to this post

    Hello Karl,

    When embedding RadDatePicker,RadTimePicker,RadDateTimePicke and RadMonthYearPicker controls inside a data-bound control, use a data-binding expression to bind the value of the input control to the data source of the parent control.
    <telerik:RadGrid  ID="RadGrid1" runat="server">
    . . . .
          <telerik:RadDateTimePicker ID="RadDateTimePicker3" runat="server" Culture="English (United States)"   SelectedDate='<%# Bind("StartTime") %>'>
             <DateInput ID="DateInput3" runat="server" />
    For further information you can check the following demo.
    Calendar / Data Binding.

  3. Karl Wilkens
    Karl Wilkens avatar
    206 posts
    Member since:
    Oct 2012

    Posted 03 Aug 2011 Link to this post

    Hi, I tried this exact thing and it does not work.

                                        <telerik:GridTemplateColumn DataField="StartTime" HeaderText="Starts" UniqueName="TemplateColumn2">


                                        <telerik:RadDateTimePicker ID="RadDateTimePicker3" runat="server" Culture="English (United States)" SelectedDate='<%# Bind("StartTime") %>'  >

                                     <DateInput ID="DateInput3" runat="server" />

                                     </telerik:RadDateTimePicker>  </EditItemTemplate>

                                     <ItemTemplate><asp:Label ID="lblSessionStart" runat="server" Text='<%# Eval("StartTime") %>' /></ItemTemplate>


    I also verified that the time is in fact valid within RadGrid ItemCreated as follows

                 Dim StartDate As RadDateTimePicker = CType(e.Item.FindControl("RadDateTimePicker1"), RadDateTimePicker)

                    If StartDate IsNot Nothing Then

                        StartDate.SelectedDate = DataBinder.Eval(e.Item.DataItem, "StartTime")

                    End If

    In the above code, debugging reveals the selectedDate to have a time of 7:00:00 AM, but once the grid renders the time is 12:00:00 AM


  4. Mira
    Mira avatar
    1124 posts

    Posted 08 Aug 2011 Link to this post

    Hello Karl,

    In order to implement the desired functionality, I recommend that you use the ItemDataBound event.
    You can examine the Distinguishing the major differences between ItemCreated and ItemDataBound events help topic for additional information.

    I hope this helps.

    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top