Search code examples
kendo-uiasp.net-mvc-5kendo-asp.net-mvc

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


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"))

Solution

  • 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>