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'm having a brain freeze for the error, generating in the following code;
It seems that:
var firstImageUrl = images.First();
Goes wrong because the Extension Method First (LINQ) cant be found.Anyone?
@inherits umbraco.MacroEngines.DynamicNodeContext @using umbraco.MacroEngines; @using System.Linq; @using System.Xml.Linq@using umbraco.cms.businesslogic.media;@{ var csv = uQuery.GetCurrentNode().GetProperty<string>("articleImages"); var images = uQuery.GetMediaByCsv(Model.articleImages); var firstImageUrl = images.First(); var urlMediumFirst = String.Format("/ImageGen.ashx?image={0}&width=300&height=300&constrain=true",firstImageUrl); <div id="imageGallery"> <div id="imageGalleryPlaceHolder"><div id="imageGalleryContent"><img id="mainProductImage" src="@urlMediumFirst" border="0"/></div></div> <div id="imageGalleryButtons"> @foreach (Media img in images) { var imageUrl = img.GetImageUrl(); var urlMedium = String.Format("/ImageGen.ashx?image={0}&width=300&height=300&constrain=true",imageUrl); var urlSmall = String.Format("/ImageGen.ashx?image={0}&width=50&height=50&constrain=true",imageUrl); <a href="#" rel="@urlMedium" class="galleryImage"><img src="@urlSmall" border="0"/></a> } </div> </div>}
Ahhh the keyword is "Dynamic" I had to cast the object first:
var images = uQuery.GetMediaByCsv(Model.articleImages) as IEnumerable<Media>;
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
System.Collections.Generic.List<umbraco.cms.businesslogic.media.Media>' does not contain a definition for 'First'
I'm having a brain freeze for the error, generating in the following code;
It seems that:
var firstImageUrl = images.First();
Goes wrong because the Extension Method First (LINQ) cant be found.
Anyone?
Ahhh the keyword is "Dynamic" I had to cast the object first:
var images = uQuery.GetMediaByCsv(Model.articleImages) as IEnumerable<Media>;
is working on a reply...