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

KendoUI + MVC 4 + Razor

4 Answers 486 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Igor Macedo
Top achievements
Rank 2
Igor Macedo asked on 19 Jul 2012, 08:01 PM
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

4 Answers, 1 is accepted

Sort by
0
Igor Macedo
Top achievements
Rank 2
answered on 19 Jul 2012, 10:42 PM
The project is available on:

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

Regards

Igor
0
Daniel
Telerik team
answered on 20 Jul 2012, 11:34 AM
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!
0
Igor Macedo
Top achievements
Rank 2
answered on 20 Jul 2012, 04:04 PM
Hi Daniel,

Works like a charm.

Thanks for your help.

Igor
0
Chris
Top achievements
Rank 1
answered on 22 Jul 2012, 07:59 PM
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?
Tags
General Discussions
Asked by
Igor Macedo
Top achievements
Rank 2
Answers by
Igor Macedo
Top achievements
Rank 2
Daniel
Telerik team
Chris
Top achievements
Rank 1
Share this question
or