Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > General Discussions > Do MVC Extensions work with Non-MVC Razor Projects?

Not answered Do MVC Extensions work with Non-MVC Razor Projects?

Feed from this thread
  • Stuart Clement avatar

    Posted on Feb 29, 2012 (permalink)

    Hi There,

    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

    Script Registrar:
    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.

    thanks

    Stuart


    Reply

  • Atanas Korchev Atanas Korchev admin's avatar

    Posted on Feb 29, 2012 (permalink)

    Hello,

     Telerik Extensions for ASP.NET MVC work only in ASP.NET MVC applications. They won't work in WebMatrix projects (which are using the Web Pages framework instead of ASP.NET MVC).

    Regards,
    Atanas Korchev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.

    Reply

  • Stuart Clement avatar

    Posted on Feb 29, 2012 (permalink)

    Hi Atanas,

    Thanks for the reply. I'm wondering, what are my options then? I seem to have a 'dud' project that is using a nice new cutting edge syntax (Razor) but I'm actually stuck, in that I can't use either of Teleriks products - MVC Extensions or ASP.NET RadControls. Is it possible to mix aspx and .cshtml files in the one project - and a WebMatrix project at that - and have it all work? Or am I looking at either a complete rewrite back to ASP.NET (.aspx pages) to use RadControls, or migrate my Razor (.cshtml) pages over to MVC and use the MVC Extensions?

    There has to be some way to work around this situation?

    thanks

    Stuart

    Reply

  • Atanas Korchev Atanas Korchev admin's avatar

    Posted on Mar 1, 2012 (permalink)

    Hi, 

    ASP.NET Web Pages (a.k.a. WebMatrix project) is entirely different technology and is not fully compatible with ASP.NET MVC or ASP.NET WebForms. As a result components made for ASP.NET WebForms (RadControls for ASP.NET Ajax) and ASP.NET MVC (Telerik Extensions for ASP.NET MVC) won't work in a Web Pages project.

    You have three options:
    1. Check our Kendo UI project. It is a set of HTML5 widgets which are not dependent on any server-side technology. This means that you can use them in your WebMatrix project.
    2. Migrate to ASP.NET MVC with Razor and use Telerik Extensions for ASP.NET MVC
    3. Migrate to ASP.NET WebForms and use RadControls for ASP.NET Ajax. I think this path would require a lot of rework though. Migrating from Razor to ASPX may be a long and tedious process.

    Regards,
    Atanas Korchev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > General Discussions > Do MVC Extensions work with Non-MVC Razor Projects?