KendoUI + MVC 4 + Razor

5 posts, 0 answers
  1. Igor Macedo
    Igor Macedo avatar
    26 posts
    Member since:
    Jun 2012

    Posted 19 Jul 2012 Link to this post

    Hello all,

    I'm trying to create my first demo with KendoUI and I got an JS error.

    I've tried on IE (doesn't works) and Chrome (works with warnings). What I'm doing wrong?

    Microsoft JScript runtime error: Object doesn't support property or method 'kendoNumericTextBox'

    And my code is:

                    <p><label for="currency">Price:</label><br>                    <input class="k-input" id="currency" max="100" min="0" name="currency" type="number" value="30" /><script><br><span class="Apple-tab-span" style="white-space:pre">  </span>jQuery(function(){jQuery("#currency").kendoNumericTextBox({format:"c"});});<br></script><br>                </p>

    There is my headers:

    <!-- KendoUi -->
    <link rel="stylesheet" href="/Content/kendo.common.min.css">
    <link rel="stylesheet" href="/Content/kendo.default.min.css">
    <script src="/Scripts/jquery.min.js"></script>
    <script src="/Scripts/kendo.web.min.js"></script>
    <script src="/Scripts/kendo.aspnetmvc.min.js"></script>

    And all files was loaded successfully.

    Thanks in advance

    Igor
  2. Igor Macedo
    Igor Macedo avatar
    26 posts
    Member since:
    Jun 2012

    Posted 19 Jul 2012 Link to this post

    The project is available on:

    https://www.dropbox.com/s/7da0pu3yi8gum1j/KendoUI.Demo.rar

    Regards

    Igor
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 20 Jul 2012 Link to this post

    Hello Igor,

    The error is thrown because jQuery is included after the Kendo scripts and so when the initialization script is executed the method cannot be found e.g.

        </footer>
        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </body>
    Removing it should resolve the problem.

    Regards,
    Daniel
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Igor Macedo
    Igor Macedo avatar
    26 posts
    Member since:
    Jun 2012

    Posted 20 Jul 2012 Link to this post

    Hi Daniel,

    Works like a charm.

    Thanks for your help.

    Igor
  6. Chris
    Chris avatar
    25 posts
    Member since:
    Apr 2011

    Posted 22 Jul 2012 Link to this post

    I came across this same problem when using the instructons supplied by Telerik at http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/introduction

    I suspect, like Igor, I was using  an ASP.MVC project template in VS2010 and the  deault _Layout.cshtml file includes this offending line of code.

    Is it worth you guys putting this instruction in the "Getting Started" notes with Kendo UI as it has taken me a good few hours to find the solution to this and I bet a lot of other developers are also using Visual Studio as their starting point?
Back to Top
UI for ASP.NET MVC is VS 2017 Ready