umbracoumbraco7umbraco-mvc

how to render MVC views from SurfaceController?


I have installed Umbraco 7 in MVC application. Have you achieved ever rendering MVC View from Surface Controller ? If it is possible to do how it can be done by passing model and passing a query string parameter to View ?


Solution

  • If I understand your question correctly, you need to use an approach called Route Hijacking, rather than surface controllers.

    Simplified, the steps are:

    In your view / template, you will then be able to use

    @model MyNewModel
    

    instead of

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    

    Here is a very good tutorial / explanation on the approach.

    Be sure to read the follow up post too