I am facing one problem with Kendo UI server wrappers in ASP.NET MVC 4 If I use .ASPX default view It understands the
<%: Html.Kendo().Grid() %>
But at the same time If I try to add Razor view It do not understand
@(Html.Kendo() ) systax.
I have entry in web.config as well
<namespaces>
<add namespace="Kendo.Mvc.UI" />
<httpHandlers>
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
</httpHandlers>
<handlers>
<add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
Pl tell me what I must be missing and where
Thanks and Regards,
Amit
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With