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

Javascript errors with MVC - Object doesnt support this method or property

5 Answers 558 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nilesh
Top achievements
Rank 1
Nilesh asked on 24 Jul 2012, 01:22 PM
I integrated the Kendo UI MVC controls with MVC 3 app, as mentioned in the link http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/introduction.

but getting Javascript errors with MVC - Object doesnt support this method or property

e.g.

jQuery(function(){jQuery("#Grid").kendoGrid()

here getting error "kendoGrid" Object doesnt support this method or property

)here getting error " Object doesnt support this method or property

5 Answers, 1 is accepted

Sort by
0
H
Top achievements
Rank 1
answered on 26 Jul 2012, 02:45 PM
We are having the same problem.

Can anyone help?

We are on MVC 4, and were using the Q1 2012 release of the MVC tools.  

We are trying to run that "side by side" with Kendo in our project.

We get this error on IE 8, but not on Chrome or Firefox.

We installed the Kendo Complete for MVC and are attempting to convert one of our grids to a Kendo grid to test out the functionality.

I added these scripts to our .master file:
<script type='text/javascript'  src="<%= Url.Content("~/Scripts/jquery.min.js") %>"></script>
<script  type='text/javascript' src="<%= Url.Content("~/Scripts/kendo.web.min.js") %>"></script>
    <script  type='text/javascript' src="<%= Url.Content("~/Scripts/kendo.aspnetmvc.min.js") %>"></script>


    
0
Ivan
Top achievements
Rank 1
answered on 01 Aug 2012, 07:12 PM
We're getting the same error. We're using MVC4 as well and we're running the grid inside a Kendo Window when we get the Javascript error only in IE8. 
If we pull the grid out of Kendo window, we do not get any Java script error in IE8. Everything works fine.

Here's our razor code for the grid inside Kendo window.

@(Html.Kendo().Window()
    .Name("categories_window")
    .Title("Select multiple items")
    .Content( @<text>
        @(Html.Kendo().Grid(Model)    
        .Name("grdCategory")
        .Columns(columns =>
        {
            columns.Bound(p => p.Code).Groupable(false);
            columns.Bound(p => p.Description);
        })
        .Groupable()
        .Pageable()
        .Sortable()
        .Scrollable()
        .Filterable()
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("CategoriesRead", "PriceList"))
        )
    )
    </text>)
    .Draggable()
    .Visible(false)
    .Width(600)
    .Height(400)
    )
0
Vesselin Obreshkov
Top achievements
Rank 2
answered on 01 Aug 2012, 07:37 PM
We are having similar issues with Kendo window. I've had to resort to using partial views and doing things like:

@(Html.Kendo().Window().Name("MyWindow")...Visible(false))

And then read the content of your partial and initialize the window object similar to this:

<script>
$.ajax({
  type: 'POST',
  url: '@Url.Action("_GridPartial", "Controller")',
  data: 'id=1&arg1=abc&etc',
  sucess: function (response) {
    var wnd = $('#MyWindow').data('kendoWindow');
    wnd.content(response);
    wnd.center().open();
  },
  error: function (request, status, error) {
    // Handle error
  }
});
</script>
0
David Beck
Top achievements
Rank 1
answered on 09 Aug 2012, 08:10 PM
Hi Everyone,

if this is a new MVC project please check the following as it took mean hours to find the solution.

Sometimes Visual Studio when creating a new MVC Project places the following on the bottom of the _Layout
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)

Even though i manually declared this above it was causing the same error. Moved both lines to the end of the </head> tag and all is working beautifully.
0
venkat
Top achievements
Rank 1
answered on 20 Oct 2012, 02:58 PM

Hello David Beck,

Your answer worked well for me.

Hopefully worked for all..

Thanks,
Venkat

Tags
General Discussions
Asked by
Nilesh
Top achievements
Rank 1
Answers by
H
Top achievements
Rank 1
Ivan
Top achievements
Rank 1
Vesselin Obreshkov
Top achievements
Rank 2
David Beck
Top achievements
Rank 1
venkat
Top achievements
Rank 1
Share this question
or