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

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

1 Answer 47 Views
Documentation and Tutorials
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 12 Oct 2011, 01:50 PM
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.

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 17 Oct 2011, 03:04 PM
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
Tags
Documentation and Tutorials
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or