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

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

1 Answer 37 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Divya
Top achievements
Rank 1
Divya asked on 31 May 2018, 10:19 PM

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!





1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 04 Jun 2018, 02:47 PM
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.
Tags
Date/Time Pickers
Asked by
Divya
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or