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...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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...