.Net core razor helper generates double id

3 posts, 0 answers
  1. Jamal
    Jamal avatar
    4 posts
    Member since:
    Sep 2017

    Posted 20 Sep 2018 Link to this post

    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. Jamal
    Jamal avatar
    4 posts
    Member since:
    Sep 2017

    Posted 21 Sep 2018 in reply to Jamal Link to this post

    Ok, i do workaround. WIth javascript replacing html nodes. However will be nice to know clean solution.
  3. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 25 Sep 2018 Link to this post

    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.
Back to Top