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.
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.
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.
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:
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:
All other selected macros which use usercontrol are rendered correctly.
Hopefully that makes sense.
Could someone advise on this please?
Best regards, Max
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.
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:
Could you show very short example of how to do this with RenderContourForm.ascx please?
Best regards, Max
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.
Thank you again Barry,
I will investigate it further and will see what I can do from what you suggested.
Best regards, Max
is working on a reply...