Displays my DateTime picker along with a textbox with the value of the datetimepicker

2 posts, 0 answers
  1. Divya
    Divya avatar
    7 posts
    Member since:
    Apr 2017

    Posted 31 May 2018 Link to this post

    Hello,

     

    I'm presently using asp.net core Kendo DateTimePicker control -


                                        @(Html.Kendo().DateTimePickerFor(m => m.DateTime)
                                    .HtmlAttributes(new { style = "width:300px;", id = "DateTime" })
                                    .Value(Model.DateTime)
                                        )

    Also, I have a hidden variable in the form,

                <input type="hidden" asp-for="DateTime" />

     

    The problem here is it displays two controls, it gets and sets the data in the right way! Would appreciate any help! Thanks in advance!





  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 04 Jun 2018 Link to this post

    Hi Divya,

    Could you please provide more context of the exact scenario, because I have tested this locally and the hidden input is not visible, unless the hidden input is with specified "id" attributing matching the field name, which will generate two elements with the same identifier and when the DatePicker is initialized it will find the first element on the page and will initialize the widget over it.

    On a side note, could you please elaborate why you need to place a hidden input element for the same property? When the form is submitted, it will send two values for the same field, which will result in incorrect behavior.

    Looking forward to your reply with the additional information.


    Regards,
    Konstantin Dikov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top