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

RadDateTimePicker: Start typing the time when the date is selected.

3 Answers 94 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Kurt
Top achievements
Rank 1
Kurt asked on 22 Nov 2010, 12:01 PM
We're using the RadDateTimePicker to insert dates and times. When a user selects a date in the calendar, the user stille has to select the time in time in the input box to edit it.

Is there a way to automatically place the cursor at the possition of the time text when a date is selected so he/she can immediatly start typing a new time.

If possible, can you also add a mask to the time text?

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 Nov 2010, 12:35 PM
Hello,


One suggestion is opening the time popup soon after selecting date. This functionality, you can add by using following code.

Code:
        <telerik:RadDateTimePicker ID="startDate" runat="server" TimePopupButton-Visible="false">
            <ClientEvents OnDateSelected="OnDateSelected" />
        </telerik:RadDateTimePicker>
   
<script type="text/javascript">
    function OnDateSelected(sender, args) {
        sender.showTimePopup();
    }
   
</script>



Thanks,
Princy.
0
Kurt
Top achievements
Rank 1
answered on 22 Nov 2010, 01:32 PM
Thx for your reply, but we cannot use the time picker. The time picker is a good way to enter a time if you have a selection of times or a large interval, but our users must enter their times accurately to the minute.
0
Tsvetina
Telerik team
answered on 25 Nov 2010, 12:43 PM
Hi Kurt,

Since the DateInput is a specially designed text input that would handle only data fitting its requirements, you cannot set a half of its expected value using the client-side methods of the control. So, my suggestion is that you just set focus to it after the date is picket and let the user fix the time:
<telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server" ClientEvents-OnDateSelected="setFocus">
</telerik:RadDateTimePicker>
function setFocus(sender, eventArgs) {
    sender.get_dateInput().focus();
}


The other option would be to not use the built-in RadDateTime picker, but to use a separate calendar, textbox (with better fitting settings) and a button to trigger the Calendar showing, but that would require you to provide a lot more custom javascript handling the controls' events.

Best wishes,
Tsvetina
the Telerik team
Browse the vast support resources we have to jumpstart 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.
Tags
Calendar
Asked by
Kurt
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Kurt
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or