on Feb 29, 2012
I have a project that I first created in WebMatrix - so it is a non-MVC website, but it uses .cshtml Razor files for all the pages. I subsequently migrated the project out of WebMatrix in to Visual Studio 2010 Professional, and then updated all the service packs etc.. to get everything running. All works fine and I've been happily beavering away on it for the past few months.
I've reached the point now where I need to incorporate some charts, Telerik Reports, and various controls (eg: PanelBar). It seems however, after some research, that whilst I'm using Razor throughout the project, I can't get any of these components working, because the project structure is not an ASP.NET MVC layout etc... (I realise it's not just the layout, but import libraries etc...)
When I started this project I chose Razor because it was so easy and simple to build in, and it was the perfect solution for me as I'd never done any MVC development before. But obviously, there is Razor (quick and dirty in WebMatrix), and then there is Razor (in MVC), and these two don't seem to be compatible together.
When I try to add the Telerik Extensions for ASP.NET MVC to my Razor project, I get the following errors:
Style Sheet Registrar:
'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'Telerik' and the best extension method overload 'Telerik.Web.Mvc.UI.HtmlHelperExtension.Telerik(System.Web.Mvc.HtmlHelper)' has some invalid arguments
Instance argument: cannot convert from 'System.Web.WebPages.Html.HtmlHelper' to 'System.Web.Mvc.HtmlHelper'
So I guess I'm asking in a nutshell... is it possible to use the Telerik MVC Extensions in a non MVC Razor project? What's the best way to get around this limitation if it exists? Convert my project to an MVC project is obviously one method, or is it possible to include standard ASPX pages into my current project and then use the RADControls for ASP.NET?
Any help or comments from others who've done this, and either succeeded or failed would be appreciated.