Copied to clipboard

Flag this post as spam?

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


  • Max Konyukh 6 posts 76 karma points
    Nov 07, 2017 @ 16:49
    Max Konyukh
    0

    MacroScript is not rendering successfully

    Hello Umbraco community,

    Thank you for reading this. I am still rather new to Umbraco so have some problem.

    I have document type with field which has Macro Container data type. I have masterpage behind this document type with this line of code which should render all selected macros on page from this field with 'macro' alias:

    <umbraco:Item field="macro" runat="server" />
    

    Also there is a macro which uses Razor Script and using MvcRenderContourForm.cshtml template and should render Contour Umbraco Form.

    I am trying to add/select this macro in Macro Container on my content node then. After publishing the page however instead of rendered macro I see this on page:

    <Macro: (,)>
    

    All other selected macros which use usercontrol are rendered correctly.

    Hopefully that makes sense.

    Could someone advise on this please?

    Best regards, Max

  • Barry Fogarty 493 posts 1129 karma points
    Nov 07, 2017 @ 16:56
    Barry Fogarty
    1

    Hi Max,

    It sounds like you are trying to render an Razor partial view on an ASP.Net webform. This is not possible. You need to either a) use the older, WebForms compatible version of Contour for your macro (e.g. RenderContourForm.ascx) or b) if this is a new project, switching to use ASP.Net MVC for templating.

  • Max Konyukh 6 posts 76 karma points
    Nov 07, 2017 @ 17:06
    Max Konyukh
    0

    Thank you very much Barry,

    I was thinking that something seems to be wrong with mixing .ascx and .cshtml. Currently in .cshtml I am doing something like this:

    @Html.RenderMvcAction(action, controller, formGuid, formtoken, (umbraco.MacroEngines.DynamicNode)Model, (System.Dynamic.DynamicObject)Parameter)
    

    Could you show very short example of how to do this with RenderContourForm.ascx please?

    Best regards, Max

  • Barry Fogarty 493 posts 1129 karma points
    Nov 07, 2017 @ 17:16
    Barry Fogarty
    0

    What I meant by that was you should ensure the properties for the macro that renders the Contour form is a usercontrol (ascx), not an MVC partial (cshtml). You can access macro properties form the Developer section.

    It is possible you may need to use an older version of Contour that still supports ASP.net webforms. You should not need to write any custom code to solve this problem, just select the correct Contour macro for your website's setup.

    NB If you are using Umbraco v7 I would advise you, if possible to migrate to using MVC for templating, it is much better supported.

  • Max Konyukh 6 posts 76 karma points
    Nov 08, 2017 @ 08:25
    Max Konyukh
    0

    Thank you again Barry,

    I will investigate it further and will see what I can do from what you suggested.

    Best regards, Max

Please Sign in or register to post replies

Write your reply to:

Draft