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
I have a node which I'm trying to access the media picker property off, so I'm using the below:
var currentPageId = UmbracoContext.Current.PageId;
var page = Umbraco.TypedContent(currentPageId);
var videoPage = page.GetPropertyValue("video");
So I'm getting the current page ID and converting that to TypedContent and then getting the property value (video) and loading that into videoPage.
I can see that the variable has all of the properties I would expect but I can't 'get' them.
i.e. I would have thought that I could use @videoPage.Id but the Id value isn't exposed (none of the properties are).
Any ideas anyone?
var videoPage = page.GetPropertyValue<IPublishedContent>("video");
When you call page.GetPropertyValue(alias), the value is returned as an object. Since the compiler doesn't know what sort of value will actually be returned, you can't do much more than convert the value to a string.
Calling GetPropertyValue<T>(alias) instead returns a T, so the compiler knows what you're expecting and can let you access its properties and methods.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted