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

18,209

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>
Share:
18,209
K.Z
Author by

K.Z

Updated on July 26, 2022

Comments

  • K.Z
    K.Z over 1 year

    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"))
    
  • K.Z
    K.Z over 7 years
    I have done all those steps but its still not working
  • Vivek Parekh
    Vivek Parekh over 7 years
    Try adding @using Kendo.Mvc.UI in the _ViewStart.cshtml file inside the Views folder
  • Vivek Parekh
    Vivek Parekh over 7 years
    Also check if the namespace is added in the web.config inside the Views folder and not in the web.config of the root folder
  • K.Z
    K.Z over 7 years
    I have added in controller class using Kendo.Mvc.Extensions; using Kendo.Mvc.UI; and is recognizing but it still not working in razor view pages for some of reason
  • Vivek Parekh
    Vivek Parekh over 7 years
    have you tried and checked by adding in the _ViewStart.cshtml file?
  • K.Z
    K.Z over 7 years
    many thanks, I have added references in _ViewStart.cshtml and it works
  • Rawden Hoff
    Rawden Hoff over 2 years
    For me, it still didn't work until I built the project and restarted the solution.