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

TimePicker : The value 'XXX' is not valid for 'PropertyName'.

5 Answers 407 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Brandon
Top achievements
Rank 1
Brandon asked on 16 May 2016, 05:13 PM

I have MVC5 application and I am using kendo time picker to show time in 12 hr format. The ccorresponding model property is of type TimeSpan. When i submit the chosen time to server, the MVC model binding throws error

The value 'XXX' is not valid for 'PropertyName'.

 

cshtml

@(Html.Kendo().TimePickerFor(x => x.OrderTime)
              .Value("8:00 PM")
              .Min("12:00 AM")
              .Max("11:30 PM")
              .Format("hh:mm tt"))

model

public class MyModel
 {
    public TimeSpan OrderTime {get;set;}
 }

Note that if i remove Format method from the timePicker and submit the time in 24 hr format then i get chosen timespan value on server

5 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 18 May 2016, 10:08 AM
Hello Brandon,

I tried to replicate the issue locally but I was unable to. Could you please provided a small runnable sample where the issue could be replicated in order to investigate it locally?

I am looking forward to your reply.

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Brandon
Top achievements
Rank 1
answered on 19 May 2016, 01:58 AM
I think there is a issue with time picker control when you try to bind Property of time TimeSpan. To fix this issue i have change the type of the property to DateTime and then add data type attribute as [DataType(DateType.Time)]
0
Brandon
Top achievements
Rank 1
answered on 19 May 2016, 01:59 AM

*rephrased

I think there is a issue with time picker control when you try to bind Property of type TimeSpan. To fix this issue i have to change the type of the property to DateTime and then add data type attribute as [DataType(DateType.Time)]

0
Brandon
Top achievements
Rank 1
answered on 19 May 2016, 02:01 AM

I think there is a issue with time picker control when you try to bind Property of type TimeSpan. To fix this issue i have to change the type of the property to DateTime and then add data type attribute as [DataType(DateType.Time)]

0
Kostadin
Telerik team
answered on 20 May 2016, 11:25 AM
Hello Brandon,

I prepared a small sample which is working correctly on my end. Could you please try replicating the issue either in my sample or in a small runnable one in order to investigate the issue locally.

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Date/Time Pickers
Asked by
Brandon
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Brandon
Top achievements
Rank 1
Share this question
or