Hi, on the homepage of my Umbraco v8 website I want to show a list of childnodes from a given parentnode, these items are jobopenings.
Each of those childnodes have a property of the type Media.
I am having a hard time displaying the image of the childnode.
This is what I've tried so far:
@inherits Umbraco.Web.Mvc.UmbracoViewPage
@{
var jobOpenings = Umbraco.Content(Guid.Parse("09fdad92-488c-474f-a8d9-77dfe5f4bd65"))
.Children("jobopening")
.Where(x => x.IsPublished())
.Where(x => x.IsVisible())
.Where(x => x.HasProperty("showOnHomepage"))
.Where(x => (bool)x.GetProperty("showOnHomepage").Value())
.OrderByDescending(x => x.CreateDate);
}
foreach (var jobOpening in jobOpenings)
{
//Title shows up
@jobOpening .Value("title")
//The following two lines both result in the text "Umbraco.Web.PublishedModels.Image"
@jobOpening .GetProperty("image").GetValue();
@jobOpening .Value("image");
}
//This is using Models builder models by the way
foreach(JobOpening jobOpening in jobOpenings)
{
<h2> @jopOpening.Title</h2>
if(jobOpening.Image != null)
{
<img src="@jobOpening.Image.Url"/>
//Alternatively use .GetCropUrl() instead of .Url and specify the crop to display
}
}
Unable to display image property of childnode
Hi, on the homepage of my Umbraco v8 website I want to show a list of childnodes from a given parentnode, these items are jobopenings. Each of those childnodes have a property of the type Media. I am having a hard time displaying the image of the childnode.
This is what I've tried so far:
What is the correct way to show the image?
Hey Bunnynut,
Okay so I would do something like this
Thanks,
Nik
is working on a reply...