IMember GetValue<IPublishedContent> on Media Picker Property returns null
I'm working on a site which has a members section. I have extended the standard member type with some custom properties, one of them being a Media Picker - Image Only for choosing picture. Inspecting the IMember object, the "picture" property contains the Udi of the Media Node, but GetValue< returns null.
@{
int totalRecords;
var members = ApplicationContext.Current.Services.MemberService.GetAll(0, 500, out totalRecords);
}
<ul>
@foreach (IMember member in members)
{
var picture = member.GetValue<IPublishedContent>("picture");
<li>
<div class="post_thumb">
@if (picture != null)
{
<img src="@picture.Url" class="avatar photo" />
}
</div>
<div class="post_title">
<strong>@member.GetValue<string>("name")</strong>
</div>
</li>
}
</ul>
This work around solves it, but it's not a very nice solution compared to casting it right away:
var pictureUdi = member.GetValue<Udi>("picture");
if (pictureUdi != null)
picture = Umbraco.TypedMedia(pictureUdi);
IMember GetValue<IPublishedContent> on Media Picker Property returns null
I'm working on a site which has a members section. I have extended the standard member type with some custom properties, one of them being a Media Picker - Image Only for choosing picture. Inspecting the IMember object, the "picture" property contains the Udi of the Media Node, but GetValue< returns null.
This work around solves it, but it's not a very nice solution compared to casting it right away:
is working on a reply...