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'm new to 4.11, after developing on U5 - How do I get the URL for media?
I have an object which is a child of the current page and I'm trying to get the following to work...
@foreach (var teamMember in CurrentPage.Children) { if (teamMember == null || teamMember.Hidden) { continue; } <div class="teamMember teamMemberLeft"> <a href="@teamMember.Url"><img src="@Umbraco.Media(teamMember.Avatar)" alt ="@teamMember.Name" /></a> <h4><a href="@teamMember.Url">@teamMember.Name</a></h4> <p><strong>@teamMember.JobTitle</strong><br /> <a href="mailto:@teamMember.Email">@teamMember.Email</a> @if (!String.IsNullOrWhiteSpace(teamMember.Mobile)) { <br /> @teamMember.Mobile } </p> </div> }
This is returning the object name instead - 'Umbraco.Web.Models.DynamicPublishedContent', suggesting I'm missing a dynamic property to get the actual URL but what is it?
Hi Keith
Had the same issues going from U5, so will try to help. Have always used the DAMP package, but I think something like this should work.
dynamic d = @Umbraco.Media(teamMember.Avatar);
<img [email protected] />
This will hopefully point you in the right area
Regards
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting Media Url in Razor
Hi all, I'm new to 4.11, after developing on U5 - How do I get the URL for media?
I have an object which is a child of the current page and I'm trying to get the following to work...
This is returning the object name instead - 'Umbraco.Web.Models.DynamicPublishedContent', suggesting I'm missing a dynamic property to get the actual URL but what is it?
Hi Keith
Had the same issues going from U5, so will try to help. Have always used the DAMP package, but I think something like this should work.
dynamic d = @Umbraco.Media(teamMember.Avatar);
<img [email protected] />
This will hopefully point you in the right area
Regards
is working on a reply...