I am trying to use the Kendo UI MVC wrappers with ServiceStack Razor Views.
I've followed the directions as per Kendo UI Instructions in the hope that it'd be straight forward.
@Html. doesn't reveal a Kendo extension in my cshtml pages.
Could anyone kindly offer some guidance?
I updated the sections as Atanas Korchev requested
<compilation debug="true" targetFramework="4.5"> <!-- Service Stack Razor View Build Provider --> <buildProviders> <add extension=".cshtml" type="ServiceStack.Razor.CSharpRazorBuildProvider, ServiceStack.Razor, Version=2.1.*, Culture=neutral" /> </buildProviders> <assemblies> <add assembly="ServiceStack"/> <add assembly="ServiceStack.Razor"/> <add assembly="ServiceStack.Text" /> <add assembly="Kendo.Mvc"/> <add assembly="WebApplication1" /> <!-- MVC 3 Added at Atanas Korchev's request --> <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </assemblies> </compilation>
(for some reason it refuses to show the code sampe, but I added the Mvc namespaces too, to the correct section)
It now throws the error:
'ServiceStack.Html.HtmlHelper<dynamic>' does not contain a definition for 'Kendo' and the best extension method overload 'Kendo.Mvc.UI.HtmlHelperExtension.Kendo(System.Web.Mvc.HtmlHelper)' has some invalid arguments}
I pasted in @(Html.Kendo().DatePicker().Name("Birthday")) to my view and attempt compile, as per Atanas' request to get this error
I am thinking a solution is not possible without some source changes to handle ServiceStack's HtmlHemlper?
Original Web.config
<?xml version="1.0"?>
<configuration>
<!-- Separate config section for each at the bottom of web.config -->
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.5">
<!-- Service Stack Razor View Build Provider -->
<buildProviders>
<add extension=".cshtml" type="ServiceStack.Razor.CSharpRazorBuildProvider, ServiceStack.Razor, Version=2.1.*, Culture=neutral" />
</buildProviders>
<assemblies>
<add assembly="ServiceStack"/>
<add assembly="ServiceStack.Razor"/>
<add assembly="ServiceStack.Text" />
<add assembly="Kendo.Mvc"/>
<add assembly="WebApplication1" />
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5" />
</system.web>
<!-- Register ServiceStack to listen on root path of web server -->
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
<appSettings>
<!-- Enables ServiceStack.Razor pages -->
<add key="webPages:Enabled" value="false" />
</appSettings>
<!-- ServiceStack.Razor Config -->
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="ServiceStack.Razor.ViewPage">
<namespaces>
<!-- Make these namespaces available to razor views-->
<!-- Required for ServiceStack -->
<add namespace="ServiceStack.Html" />
<add namespace="ServiceStack.Razor" />
<add namespace="ServiceStack.Text" />
<!-- Business -->
<add namespace="WebApplication1" />
<!-- Kendo UI MVC Wrappers -->
<add namespace="Kendo.Mvc.UI" />
</namespaces>
</pages>
</system.web.webPages.razor>
</configuration>