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

Razor Tag vs TagHelper (ID generation)

1 Answer 153 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Pier-Gilles
Top achievements
Rank 1
Pier-Gilles asked on 05 Sep 2018, 05:26 PM

The tag helper for a DatePickerFor   and the Razor Tag for a DatePickerFor generate different ID for their respective control.

 Tag Razor: @(Html.Kendo().DatePickerFor(m => m.testObject.TestSousObject))

Generate : <input id="testObject_TestSousObject" name="testObject.TestSousObject" type="text" value="" /><script>kendo.syncReady(function(){jQuery("#testObject_TestSousObject").kendoDatePicker({"format":"yyyy-MM-dd"});});</script>

Where the Id = testObject_TestSousObject  (with an underscore)

---------------------------

 <kendo-datepicker name="DateComparaisonExamensImagerieAnterieurs" for="ExamensImagerieMedicale.DateComparaisonExamensImagerieAnterieurs" />

Generate :  <input id="testObject.TestSousObject" name="testObject.TestSousObject" type="text" value="" /><script>kendo.syncReady(function(){jQuery("#testObject\\.TestSousObject").kendoDatePicker({});});</script>

Where the Id = testObject.TestSousObject  (with a dot)

Is it something new  with .NET Core compared to MVC? In my mind, both method should generate the same Code and Ids.

 

Note:  I tested it with a entirely new .NET core 2.1 project 

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 10 Sep 2018, 12:24 PM
Hello,

The tag helpers are in essence different from the html helpers and use a different code base. Thus it is expected to not behave in the same exact manner. However if problems occur due to the different initialization we would gladly assist you to resolve them. That said I would kindly like to ask are there any issues when using the tag helper with the provided configuration?

Regards,
Angel Petrov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Date/Time Pickers
Asked by
Pier-Gilles
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or