ASP.NET MVC controls are generating inline javaScript

2 posts, 0 answers
  1. Pero
    Pero avatar
    1 posts
    Member since:
    Mar 2015

    Posted 20 Mar 2015 Link to this post


    We are using ASP.NET MVC controls, and we have one potential deal breaker.

    When we open the HTML source off a rendered page we see the HTML code generated by the Telerik control and immediately below it we see a <script> tag with some javascript for that control. This is very bad for us, and we don't want to have javascript code mixed in the HTML.

    Is there an alternative to this issue or it is just how the controls are designed?

    Thank you!
  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 23 Mar 2015 Link to this post

    Hi Pero,

    Indeed the Kendo UI MVC wrappers output a <script> element with the initialization script. This can be disabled by calling the Deferred() method. However you should later manually call Html.Kendo()().DeferredScripts() otherwise the widgets will remain uninitialized. More information is available here.

    Atanas Korchev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top