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

Issues on DateTimePicker

7 Answers 228 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Dev
Top achievements
Rank 1
Veteran
Dev asked on 04 Jul 2019, 03:01 PM

We are facing the below issues on DateTimePicker

1st issue:
1) Enter the date, month & year.
2) If we highlight the whole date & update any value, year field is getting changed.
We need it to update from month date & year if it is fully highlighted.

2nd issue:
1) Enter the date, month & year.
2) If we click "Tab" it is getting focused on the next date time picker. When we go back to the previous datetimepicker it is focussing on the edited year.
It should focus on month on every datetimepicker.

Note : If datetimepciker is fully highlighted it should update on MM/DD/YYYY. Demo project & video link attached for your reference. 

Datetimepicker Working Video

Demo Project

7 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 08 Jul 2019, 06:44 AM
Hello Rick,

1. I was not able to reproduce this on my side (see attached). When I select the entire date and start editing the month is selected. Do I need to do anything specific in this case? 

2. I was able to reproduce that, you can use the following approach for it:
Public Sub Datetimetype1(DName As RadDateTimePicker)
   'other code omitted
 
    AddHandler RadDateTimePicker1.DateTimePickerElement.TextBoxElement.TextBoxItem.GotFocus, AddressOf GotFocus
 
End Sub
 
Public Sub GotFocus(ByVal sender As Object, ByVal e As EventArgs)
    Dim dtprovider1 As MaskDateTimeProvider = TryCast(Datepickename1.DateTimePickerElement.TextBoxElement.Provider, MaskDateTimeProvider)
    dtprovider1.SelectFirstItem()
 
End Sub

I am looking forward to your reply.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Dev
Top achievements
Rank 1
Veteran
answered on 12 Jul 2019, 06:57 AM
Hello Dimitar,

Please follow the below steps to reproduce the issue.

Issue1 : 
Enter the month, date & year and without clicking anywhere please select the datetimepicker value from right to left, and enter the value it will focus on year.

Issue 2:
Thanks it is working fine, on the event which you have given, while running it does not call the autoselectnextpart event. But it should work like without pressing the arrow keys it should go to the next cell.
0
Dimitar
Telerik team
answered on 15 Jul 2019, 11:59 AM
Hi Rick,

1. I was able to reproduce that, but, if I comment the SelectedItemChanged event handler the issue does not occur. Would it be possible to explain the purpose of this code and your exact requirement?

2. The AutoSelectNextPart is already set in your code and adding the GotFocus event handler is not breaking this behavior on my side. Perhaps you can attach a new project where this is broken? 

I am looking forward to your reply.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Dev
Top achievements
Rank 1
Veteran
answered on 15 Jul 2019, 02:31 PM

Hi Dimitar,

Issue 2:

Thank you for the suggested solution it is working fine.

Issue 1:

The selecteditemchanged event is to stop the AutoSelectNextPart in the year cell. AutoSelectNextPart should be stopped in the year field & should not move further.

We have used a link for implementing it, link mentioned below for your reference.
->   link

Our requirement, if the cell column is fully highlighted (left-right/right-left, double clicked on the datetimepicker) & if we make any changes, it should start editing from month.

 

0
Dimitar
Telerik team
answered on 16 Jul 2019, 08:07 AM
Hello Rick,

You have to handle these cases separately. I have updated the project and I have added MouseDown and KeyDown event handler which are selecting the first item. 

I hope this helps. Should you have any other questions, do not hesitate to ask. 

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Dev
Top achievements
Rank 1
Veteran
answered on 16 Jul 2019, 03:20 PM

Hi Dimitar,

Thanks for the test project. It works but we have a small issue on it. In the test project once we click the datetimepicker it is getting focused on 1st entry (month) but we need an option to select the month/date/year or any of the 2 entries (month & date or date & year).

Please remove the selection option on month & enable an option for selection based on the user click. If the user clicks near to/on year it should focus on year & same applies to others too.

We'll share a video link of old application control for your reference.

Demo video

 

0
Dimitar
Telerik team
answered on 17 Jul 2019, 10:51 AM
Hello Rick,

The mistake is mine, you should check for the SelectionLength in the MouseUp event handler as well:
Private Sub TextBoxItem_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs)
    Dim item = TryCast(sender, RadTextBoxItem)
    Dim control = TryCast(item.ElementTree.Control, RadDateTimePicker)
 
    Dim dtprovider As MaskDateTimeProvider = TryCast(control.DateTimePickerElement.TextBoxElement.Provider, MaskDateTimeProvider)
 
    If dtprovider.SelectedItemIndex <> 0 And item.SelectionLength > 4 Then
        dtprovider.SelectFirstItem()
 
    End If
End Sub

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DateTimePicker
Asked by
Dev
Top achievements
Rank 1
Veteran
Answers by
Dimitar
Telerik team
Dev
Top achievements
Rank 1
Veteran
Share this question
or