Hi Guys
This stupid little issue is taking up way way too much time for me to resolve..
I am setting a timepicker as follows:
<td class="tg-7uzy">
@Code
With Html.Kendo().TimePicker()
.Name("1Open")
.Events(Function(events) events.Change("settime"))
.Value(New TimeSpan(0, Model.Hours(1).open, 0))
.Min(New TimeSpan(0, 0, 0))
.Max(New TimeSpan(0, 0, 0))
.Render()
End With
End Code
</td>
The result is as per the attached screen shot.
It 'looks like' the values are set right as the timepickers have the correct times , but when you drop down, it always starts at midnight and the current time is not highlighted. I assume the timepicker needs the value to be set with AM or PM .. but that can't be done from a TimeSpan or a datetime.. the am pm always has dots ( a.m. , p.m.)
If tried adding .Format("HH:mm:tt") and .ParseFormats(New String() {"HH:mm:tt"}) etc, but I just can't get it to work. ( I've tried allot more formats than just these, I've tried "HH:mm tt" ,"HH:mm t.t." ( cause it's the dots around the am pm which seems to be whats stopping.))
Feeling a bit stupid having to ask this as it seems to be a straightforward thing.
I'm sure I will have a Face palm moment when shown the error in my ways.. but I've got to the point of not caring! :)
Cheers
Rob
9 Answers, 1 is accepted
HelloRob,
I tried to replicate the behavior, however, I was not able to. Check out the online example where the initial time is selected when you open the dropdown.
http://demos.telerik.com/aspnet-mvc/timepicker/index
Please let me know what needs to be different in order to replicate the behavior you are observing.
Regards,
Telerik by Progress
You reference is setting a timepicker from a string.. I don't want to store times as strings.
I note from the docs that this method is a TimeSpan
Methods
Value(System.Nullable<System.TimeSpan>)
Sets the value of the timepicker input
I am storing the times as 'minutes since midnight'
Hence I have setting
.Value(
New
TimeSpan(0,600, 0))
compared to the example you linked to which is
.Value(
"10:00 AM"
)
Thanks
Rob
Please make sure that you are using the latest version of the components. The current release is 2016.2.714. Upgrade KendoUI and the time should be focused as expected.
I made a sample video of the behavior I am seeing on my end with the latest release. Check it out here.
Regards,
Viktor Tachev
Telerik by Progress
Thanks
So at least I know it should work how I am trying! :)
I have( already had) the very latest everything here and not the same results.
To test;
I just created a new Telerik ASP.NET MVC Application. ( screen shot attached)
Added the same code as you in the index screen
(Screen shot attached)
Hit run and it doesn't work. :(
Maybe this is a regional / Time display issue / Bug?
Thanks
Rob
Sorry , some of those pictures got screwed up somehow.. attach some new ones.
I considered adding the new project, but it is literally a new Telerik ASP project template with the single div added.. seems pointless!
Thanks
Rob
I can confirm this is a Regional /time format issue.
If I change my system to to UK time formats ( and others) it works.
It seems that the standard NZ time format with the lower case am pm with the dot's is causing the issue. ( Not sure what other regions are affected)
I can't have a solution that only works in some regions obviously.
Can you suggest any nice ways of handling this?
Thanks
Rob
I wish I could edit rather than more posts..lol
FYI: I have carried on with this project and the Timepickers are now 'fors'
@Code
With
Html.Kendo().TimePickerFor(
Function
(f) f.sun_open)
.Name(
"0Open"
)
.Events(
Function
(events) events.Change(
"settime"
))
.Min(
New
TimeSpan(0, 0, 0))
.Max(
New
TimeSpan(0, 0, 0))
.Render()
End
With
End
Code
Changed the Model to be timespan obviously.
When displayed , the time picker is showing the correct time in the NZ time format , but once again it is not actually setting the value of the time picker. :(
Regards
Rob
In this case it will be best to open a official support ticket and send us isolated runnable version of your applictaion that demonstrates the problem. Thus we will be able to replicate the issue locally and advise you further.
Regards,
Maria Ilieva
Telerik by Progress
Hi Alex,
This thread is a pretty old one.
Can you open a new formal Support Ticket and send us your TimePicker definition there?