Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Documentation and Tutorials > picking time only results in date changing to today's date?

Not answered picking time only results in date changing to today's date?

Feed from this thread
  • Jonathan avatar

    Posted on Oct 12, 2011 (permalink)

    We're currently using an ASCX page as the edit template for a grid. We have some dates and times in the grid, but in this particular grid we want to allow the user to change the time but not change the date when editing an existing item. We use a label to display the date, and a RadTimePicker to display the time.

    The problem is, whenever the user edits the time, the date is changing to today's date rather than maintaining the original date and only changing the time. Below is the definition of the control. Is our definition of the control missing something that would cause it to keep the date stored? Do RadTimePickers not store the date at all and I need to find some way of concatenating the results?

    Below is the definition for one of these label-radtimepicker pairs.

    <asp:Label id="txtDateIn" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.DateIn","{0:MM/dd/yy}") %>' Width="48px" />
                            <telerik:RadTimePicker ID="RadDateTimePicker3" EnableEmbeddedSkins="false" Skin="UCP_Vista" Width="85px" DbSelectedDate='<%# DataBinder.Eval( Container, "DataItem.DateIn")%>' runat="server">
                                <TimeView ID="TimeView1" runat="server" Interval="00:15:00" Columns="6" EnableEmbeddedSkins="false" Skin="UCP_Vista" ShowHeader="false" />
                                <DateInput ID="DateInput1" runat="server" Font-Size="11px" Font-Bold="true" ForeColor="#396F96" CssClass="itemt" />
                            </telerik:RadTimePicker>

    I didn't see a forum for the date/time pickers, so if I missed one this belongs in, please feel free to move it to the correct forum.

    Reply

  • Vasil Vasil admin's avatar

    Posted on Oct 17, 2011 (permalink)

    Hello Jonathan,

    RadTimePicker can be used to select time, but it will return the current date, because internally it uses DateTime object which can't hold null date.
    After the user selection, you could construct new DateTime object with date from your label and time from the TimePicker similar to how is done in this forum thread:
    http://www.telerik.com/community/forums/aspnet-ajax/calendar/raddatepicker-and-radtimepicker-to-use-same-date.aspx

    Greetings,
    Vasil
    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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Documentation and Tutorials > picking time only results in date changing to today's date?