Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kris Dyson 54 posts 79 karma points
    Aug 27, 2013 @ 16:13
    Kris Dyson
    0

    Embedding an MVC form inside the old master template architecture

    Hi there, I have an old Umbraco web application which was upgraded to v6 earlier this year.

    It uses .NET ascx user controls and your standard .master pages as you'd expect.

    I now need to create a brand new page which is essentially a booking form for an event.

    I'd like to create it using MVC, as I do everything with MVC nowadays. I don't really want to duplicate the page layout / the frame. Is it possible to embed an MVC partial view inside the old master templates?

    thanks

    Kris

  • Connie DeCinko 931 posts 1160 karma points
    Feb 23, 2015 @ 23:30
    Connie DeCinko
    0

    Similar issue here. Did you figure out a solution?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 24, 2015 @ 12:53
    Jeroen Breuer
    0

    Hello,

    Yes it's possible to use a Partial View Macro and embed that Marco on your .master page.

    Jeroen

  • Connie DeCinko 931 posts 1160 karma points
    Feb 24, 2015 @ 16:39
    Connie DeCinko
    0

    Is there a tutorial or standard way to do this? I've found pieces of code but nothing complete. Right now I seem to be getting an error when I add the model to my view. It's hard to debug when Umbraco just shows "Error loading Partial View script ..."

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 24, 2015 @ 17:00
    Dennis Aaen
    0

    Hi Connie,

    If I understand your questions correctly then you have an old user control that you want to use in your MVC Umbraco site.

    Try to go to the developer section --> Macros, in there create a new macro. After this you can point a Razor, XSLT file or a Usercontrol. Try to see the screenshot here.

    To be able to choose the usercontrol it needs to be located in the usercontrol folder in your Umbraco installation file system.

    Hope this helps,

    /Dennis

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 24, 2015 @ 17:08
    Jeroen Breuer
    0

    If you want more info about the error try adding umbDebugShowTrace=true to as a querystring to the url: https://our.umbraco.org/wiki/how-tos.

    Jeroen

  • Connie DeCinko 931 posts 1160 karma points
    Feb 24, 2015 @ 23:22
    Connie DeCinko
    0

    Tracing is not working, apparently does not work in Umbraco 6.1.x per the referenced link.

  • Connie DeCinko 931 posts 1160 karma points
    Feb 24, 2015 @ 23:27
    Connie DeCinko
    0

    Dennis, not exactly. I know how to do the macro part. I can create a .cshtml partial view and get that to work just fine. Now, I want to hook a model to my view so I can create strongly typed fields on my form. As soon as I add the model reference to the top of the view, it breaks.

    I tried @inherits Umbraco.Web.Mvc.UmbracoViewPage

    and both break the view: Error loading Partial View script (file: ~/Views/MacroPartials/Admin/Ethics/Opinions.cshtml)

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 25, 2015 @ 09:17
    Jeroen Breuer
    0

    Could you post the Razor code of the macro and also a screenshot of how you configured the macro in the backoffice?

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft