Home > Technical > System.Web.Mvc.HtmlHelper does not contain a definition for Kendo

System.Web.Mvc.HtmlHelper does not contain a definition for Kendo

While trying to add the KendoUI jQuery framework to an existing MVC project I cam across the following error when loading a page that used the KendoUI Grid HTML Helper:

‘System.Web.Mvc.HtmlHelper<dynamic>’ does not contain a definition for ‘Kendo’

I should have realised I was going to get an ASP.Net runtime error for the page as the Razor intellisense couldn’t find the Kendo Grid helper either:

@(Html.Kendo().Grid

The problem stumped me for a while as the only help I could find on how to solve the problem was that I had to add the following to the namespaces in the web.config:

<add namespace=”Kendo.Mvc.UI” />

However, even after adding this namespace to the web.config, the same problem continued.

The solution to the problem became apparent when I noticed that there was more than one web.config in my project and I had added the namespace to the wrong one. I had added the namespace to the web.config in the root folder of the project but when I added the same namespace to the web.config in the Views folder the intellisense began to work and my Kendo UI grid worked OK. Here’s a pic. showing the location of the web.config file I had to edit in my Visual Studio 2012 project:

kendo-mvc-ui

and here is a pic. of the namespace reference added into the web.config:

kendo-mvc-ui-namespace

  1. No comments yet.
  1. No trackbacks yet.