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
This code worked perfectly fine in Umbraco 7.3.
var image = Umbraco.TypedMedia( ( int )CurrentPage.BannerBackgroundImage.Id );
BannerBackgroundImage is of data type Media Picker.
In a clean Umbraco 7.5.4 install I get the following Exception (RuntimeBinderException).
'Umbraco.Web.Models.DynamicPublishedContentList' does not contain a definition for 'Id'
Umbraco.ModelsBuilder.Enable is set to false in the web.config.
How should I solve this?
The property BannerBackgroundImage of type media picker apperantly returns a collection??
When I go the the Media Picker data type and I check the option, "Pick multiple items", save it, uncheck it and save it again then the media picker property won't return a collection but instead a single (dynamic) Umbraco.Web.Models.PublishedContentWithKeyBase which should be casted to IPublisheContent.
IPublishedContentimage = Umbraco.TypedMedia( ( int )CurrentPage.BannerBackgroundImage.Id );
Otherwhise calls to GetPropertyValue() and GetCropUrl() ... throw an exception: 'Umbraco.Web.Models.PublishedContentWithKeyBase' does not contain a definition for 'GetCropUrl'
What is also strange is that the call image.GetPropertyValue( "umbracoWidth" ); returns a string now instead of an integer. Any idea why this is changed in Umbraco 7.5?
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted