Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"))
like image 738
K.Z Avatar asked Jun 03 '16 10:06

K.Z


2 Answers

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>
like image 92
Vivek Parekh Avatar answered Nov 16 '22 18:11

Vivek Parekh


After Installing Kendo Ui Make sure to Add this using On top of your Layout Page:

@using Kendo.Mvc.UI

like image 1
MahmoudVahedim Avatar answered Nov 16 '22 18:11

MahmoudVahedim