I am starting a new site using Umbraco version 7.6.1 assembly: 1.0.6337.40631.
I'm using Archetype as I have in a dozen other sites. I am using @Html.RenderArchetypePartials(Model.Content.GetPropertyValue
I've tried casting the object to a number of different things with no luck.
If I put a MediaPicker on my Document Type directly, I can see that the data is stored the same, but the base property converters work correctly and the usual Umbraco.Field("photo") returns the Id.
Here's how the data is stored:
Archetype: {"alias":"photo","value":"umb://media/1912ece0d5954e6891147e712d24ba69"}
Doc Type Property: ImageTest: umb://media/48e3a7837af44134a93e8d90141ece74
Is there a way to retrieve this from an Archetype? Am I missing something simple?
I tried so many things, I'm not sure which one did it, but it all the sudden started returning the media id as expected. I reinstalled everything from nuget and i'm assuming that did it. Obviously one of the type converters wasn't working correctly for some reason.
I had read that. And I will be looking out for those changes as I update my current sites. This site that I was struggling with was a brand new site and my first one that started with 7.6 Umbraco. I did notice in the definitions that the property editor name was MediaPicker2. I'm guessing that's the new one mentioned in the article.
I was used to Model.GetValue(xxx) returning the ID of the media. As I circled back to this yesterday, I finally started a new Document Type to start from scratch. I did finally get this to work as intended using your suggestion of using the generic to cast it to IPublishedContent. Model.GetValue
I am anxious to see how the upgrade works and affects some of my current sites. I guess that's my next task. But your help certainly got me over the hump on this one.
Archetype MediaPicker Udi
I am starting a new site using Umbraco version 7.6.1 assembly: 1.0.6337.40631.
I'm using Archetype as I have in a dozen other sites. I am using @Html.RenderArchetypePartials(Model.Content.GetPropertyValue
I've tried casting the object to a number of different things with no luck.
If I put a MediaPicker on my Document Type directly, I can see that the data is stored the same, but the base property converters work correctly and the usual Umbraco.Field("photo") returns the Id.
Here's how the data is stored: Archetype: {"alias":"photo","value":"umb://media/1912ece0d5954e6891147e712d24ba69"} Doc Type Property: ImageTest: umb://media/48e3a7837af44134a93e8d90141ece74
Is there a way to retrieve this from an Archetype? Am I missing something simple?
Thanks,
Trent
Hi Trent
Try to use this code:
"Umbraco.Core.Udi[]" is a type of unified ids that are using in Core with Property Value Converters for getting all data directly from entities.
Thanks,
Alex
Thank you, Alex.
I tried so many things, I'm not sure which one did it, but it all the sudden started returning the media id as expected. I reinstalled everything from nuget and i'm assuming that did it. Obviously one of the type converters wasn't working correctly for some reason.
But I do appreciate your reply!
Trent
You are welcome, Trent.
Ids or UDI settings defined in config option in umbracoSettings.config
Did you read breaking changes in 7.6 version? - https://our.umbraco.org/documentation/Getting-Started/Setup/Upgrading/760-breaking-changes#property-editors-storing-udi-instead-of-id-u4-9310
Alex
I had read that. And I will be looking out for those changes as I update my current sites. This site that I was struggling with was a brand new site and my first one that started with 7.6 Umbraco. I did notice in the definitions that the property editor name was MediaPicker2. I'm guessing that's the new one mentioned in the article.
I was used to Model.GetValue(xxx) returning the ID of the media. As I circled back to this yesterday, I finally started a new Document Type to start from scratch. I did finally get this to work as intended using your suggestion of using the generic to cast it to IPublishedContent. Model.GetValue
I am anxious to see how the upgrade works and affects some of my current sites. I guess that's my next task. But your help certainly got me over the hump on this one.
Much appreciated!
Trent
Hi Trent
You are welcome, really enjoy talking with Umbraco developers. Ask more if something.
Cheers,
Alex
is working on a reply...