as I wrote in title I have problem with take Media in foreach.
This is my code:
@foreach (var item in @Model.Children.Where("Visible").OrderBy("UpdateDate"))
{
@{
var link = new umbraco.cms.businesslogic.media.Media(item.MediaID).Children.FirstOrDefault().getProperty("umbracoFile").Value;
}
<div class="galleryListItem" style="background-image: url('/imageGen.ashx?image=@link&width=273&height=161');">
<a href="@item.Url" class="link"></a>
<div class="contentGalleryList">
<div class="highlightGalleryList">@item.Name</div>
</div>
</div>
}
and this line:
@link = new umbraco.cms.businesslogic.media.Media(item.MediaID).FirstOrDefault().getProperty("umbracoFile").Value;
give me this error:
Error loading MacroEngine script (file: GalleryList.cshtml);
What can I do to that start work? Maybe it’s some better solve of this problem?
Any help would be appreciated.
I solve it. The problem was that I have open code section in other code section.
Working code: