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

2

9

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"))
Boxhaul answered 3/6, 2016 at 10:22 Comment(0)
I
10

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>
Ial answered 3/6, 2016 at 10:47 Comment(7)
I have done all those steps but its still not workingBoxhaul
Try adding @using Kendo.Mvc.UI in the _ViewStart.cshtml file inside the Views folderIal
Also check if the namespace is added in the web.config inside the Views folder and not in the web.config of the root folderIal
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 reasonBoxhaul
have you tried and checked by adding in the _ViewStart.cshtml file?Ial
many thanks, I have added references in _ViewStart.cshtml and it worksBoxhaul
For me, it still didn't work until I built the project and restarted the solution.Candlewick
W
1

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

@using Kendo.Mvc.UI

Whimsicality answered 5/9, 2022 at 18:4 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Tisdale

© 2022 - 2024 — McMap. All rights reserved.