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

6 posts, 0 answers
  1. Brandon
    Brandon avatar
    4 posts
    Member since:
    Jan 2016

    Posted 16 May Link to this post

    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

  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 18 May Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Brandon
    Brandon avatar
    4 posts
    Member since:
    Jan 2016

    Posted 18 May in reply to Kostadin Link to this post

    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)]
  5. Brandon
    Brandon avatar
    4 posts
    Member since:
    Jan 2016

    Posted 18 May in reply to Brandon Link to this post

    *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)]

  6. Brandon
    Brandon avatar
    4 posts
    Member since:
    Jan 2016

    Posted 18 May in reply to Brandon Link to this post

    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)]

  7. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 20 May Link to this post

    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready