mvc 4 razor view do not understand @Html.Kendo()

大兔子大兔子 提交于 2019-12-03 16:23:18

To register Kendo UI using Razor templates make sure you have the below in your Views\Web.config.

Towards the bottom of the page also details the setup in telerik's documentation.

http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/asp-net-mvc-4

<system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory,
          System.Web.Mvc, Version=4.0.0.0, Culture=neutral, 
          PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
        <namespaces>
            <add namespace="System.Web.Mvc" />
            ...
            <add namespace="Kendo.Mvc"/>
            <add namespace="Kendo.Mvc.UI"/>
        </namespaces>
    </pages>
</system.web.webPages.razor>

I also have the below in my main Web.config file.

<system.web>
    <compilation debug="true" targetFramework="4.5">
        <assemblies>
           ...
            <add assembly="Kendo.Mvc"/>
        </assemblies>
    </compilation>
</system.web>

Adding @using Kendo.Mvc.UI at the top of the page and it worked for me

Check if your web.config settings is in the View Folder ( web.config files) not the root Web.config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!