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
We are new to Umbraco and seem not to be able to get the simple things able to work. We just want to display an image in a partial and can not get it to work.
The code we are using is
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ var selection = Model.Content.Site().FirstChild("caseHistoryPage").Children("") .Where(x => x.IsVisible()); } @foreach(var item in selection){ <div class="row"> <div class="col-sm-6 col-md-12"> <div class="thumbnail"> @{ var typedMediaPickerSingle = item.GetPropertyValue<IPublishedContent>("caseHistoryMainImage"); if (typedMediaPickerSingle != null ) { <img src="@typedMediaPickerSingle.Url" /> } } <div class="caption"> <h3>@item.GetPropertyValue("caseHistoryItemHeading")</h3> <p><a href="#" class="btn btn-primary" role="button">Button</a> <a href="#" class="btn btn-default" role="button">Button</a></p> </div> </div> </div> </div> }
What are we missing?
Mark, try the following code:
@{ var typedMediaPickerSingle = Umbraco.TypedMedia(@Umbraco.Field(item,"caseHistoryMainImage").ToString()); if (typedMediaPickerSingle != null ) { <img src="@typedMediaPickerSingle.Url" /> } }
Why, visit this.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Render image in partial
We are new to Umbraco and seem not to be able to get the simple things able to work. We just want to display an image in a partial and can not get it to work.
The code we are using is
What are we missing?
Mark, try the following code:
Why, visit this.
is working on a reply...