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

.Net core razor helper generates double id

2 Answers 40 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jamal
Top achievements
Rank 1
Jamal asked on 20 Sep 2018, 10:44 AM

The problem comes with Kendo helper which generates tag with same id. Eample:

<div id="myid"></div>

@(Html.Kendo().ListView<Odata.Client>()
                        .Name("myid")
                        .TagName("div")

                         bla-bla-bla

)

If I look  in the browser I will find two tags with the id "myid" one defined by me and one extra generated.

The same happens with  Html.Kendo().TabStrip() So I think it is general "feature".

With jquery version of the same functionality I can avoid this behaiviour ising $("#myid").kendoListView(...) and populate the tag which should be populated.

What is the solution in case of using helper on razor page? 

 

                    ...

 

2 Answers, 1 is accepted

Sort by
0
Jamal
Top achievements
Rank 1
answered on 21 Sep 2018, 08:59 AM
Ok, i do workaround. WIth javascript replacing html nodes. However will be nice to know clean solution.
0
Konstantin Dikov
Telerik team
answered on 25 Sep 2018, 08:00 AM
Hi Jamal,

The HTML Helpers will generate their own DOM element for initializing the widget and the Name property is used as an "id" of the wrapping element. With that in mind, please replace the DIV element with the HTML Helper and it will generated it automatically.

Hope this helps.


Regards,
Konstantin Dikov
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
General Discussions
Asked by
Jamal
Top achievements
Rank 1
Answers by
Jamal
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or