Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Dear Umbraco Team
Trying to render images if boolean field in macro is checked. with code below i get "Error loading Partial View script. any Ideas ?
@if(Model.MacroParameters["bool"]){ @{ var media = Model.MacroParameters["Image"];} @if(media !=null){ var image = Umbraco.TypedMedia(media); <img class="img-responsive" src="@image.GetPropertyValue("umbracoFile")" alt="@image.GetPropertyValue("Name")" /> } }
Thanks Dibs
Try to parse Model.MacroParameters["bool"] to to string and compare == "1"
Model.MacroParameters["bool"]
== "1"
fixed code:
@{ if (Model.MacroParameters["bool"].ToString() == "1") { var media = Model.MacroParameters["Image"]; if (media != null) { var image = Umbraco.TypedMedia(media); <img class="img-responsive" src="@image.GetPropertyValue("umbracoFile")" alt="@image.GetPropertyValue("Name")" /> } } }
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
render image if true/false macro Parameter checked
Dear Umbraco Team
Trying to render images if boolean field in macro is checked. with code below i get "Error loading Partial View script. any Ideas ?
Thanks Dibs
Try to parse
Model.MacroParameters["bool"]
to to string and compare== "1"
fixed code:
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.