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
Hi All
I am having a bit of a problem with displaying an image that has been selected with a media picker through a Partial View.
I have a pictureSectionImage and the Partial View code is as follows
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage <div class="row"> @foreach (var childPage in CurrentPage.pictureSections.Split(',')) { var page = Umbraco.Content(childPage); <div class="col-sm-3"> <div class="work wow fadeInUp"> @if(CurrentPage.HasValue("pictureSectionImage")) { <img src="@Umbraco.Media(CurrentPage.pictureSectionImage).Url" /> } <h3>@page.Name</h3> <p>@page.pictureSectionText</p> </div> </div> }
It doesn't error and it displays the Page Name and pictureSelectionText fine, but the Image doesn't display even though it has been selected on the page.
Any Ideas what I am doing wrong?
Thanks
Ben
Hi Ben,
I think you have mixed up page and CurrentPage a bit, I think what you need is this:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage <div class="row"> @foreach (var childPage in CurrentPage.pictureSections.Split(',')) { var page = Umbraco.Content(childPage); <div class="col-sm-3"> <div class="work wow fadeInUp"> @if(page.HasValue("pictureSectionImage")) { <img src="@Umbraco.Media(page.pictureSectionImage).Url" /> } <h3>@page.Name</h3> <p>@page.pictureSectionText</p> </div> </div> }
Jeavon
Of course, that's obvious now I have seen it. Thanks mate, been looking at that for a couple of hours and got myself in a muddle.
Cheers
Fab!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Image not showing in Partial View
Hi All
I am having a bit of a problem with displaying an image that has been selected with a media picker through a Partial View.
I have a pictureSectionImage and the Partial View code is as follows
It doesn't error and it displays the Page Name and pictureSelectionText fine, but the Image doesn't display even though it has been selected on the page.
Any Ideas what I am doing wrong?
Thanks
Ben
Hi Ben,
I think you have mixed up page and CurrentPage a bit, I think what you need is this:
Jeavon
Of course, that's obvious now I have seen it. Thanks mate, been looking at that for a couple of hours and got myself in a muddle.
Cheers
Fab!
is working on a reply...