htmlhelper does not contain a definition for kendo in ASP.NET MVC RAZOR

Toxic picture Toxic · Jun 3, 2016 · Viewed 15.5k times · Source

I am trying to install kendo UI for ASP.NET MVC application and I am getting following error. htmlhelper does not contain a definition for kendo

I have working ASP.NET project with kendo ui and I have copied require kendo styles and script in require folder, added namespace detail in web.config, add references in bundleConfig.cs and and kendo.mvc dll in reference. I have followed following tutorial

http://docs.telerik.com/kendo-ui/aspnet-mvc/asp-net-mvc-5

I am not what I am missing, also both application are ASP.NET MVC 5.

test code is as following which I am trying to make it work

 @(Html.Kendo().DatePicker().Name("datepicker"))

Answer

Vivek Parekh picture Vivek Parekh · Jun 3, 2016

Let ASP.NET MVC know of the Kendo.Mvc.UI namespace where the server-side wrappers are. To do this, update the web.config file of the web application.

Step 1 Open Views/Web.config, or root Web.config if using ASPX.

Step 2 Locate the namespaces tag.

Step 3 Append an add tag to the namespaces tag.

EXAMPLE

<namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="Kendo.Mvc.UI" />
</namespaces>

Step 4 Add a binding redirect to your current System.Web.Mvc version.

EXAMPLE

<dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-[version-of-kendo-dll-that-you-are-using]" newVersion="[version-of-kendo-dll-that-you-are-using]" />
</dependentAssembly>