正如我在标题中所写的那样,我在使用foreach时遇到问题。在foreach中以id身份取媒体项目 - umbraco
这是我的代码:
@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('/[email protected]&width=273&height=161');">
<a href="@item.Url" class="link"></a>
<div class="contentGalleryList">
<div class="highlightGalleryList">@item.Name</div>
</div>
</div>
}
这行:
@link = new umbraco.cms.businesslogic.media.Media(item.MediaID).FirstOrDefault().getProperty("umbracoFile").Value;
给我这个错误:
Error loading MacroEngine script (file: GalleryList.cshtml);
我能做些什么,以那开始工作?也许这是一个更好的解决这个问题?
任何帮助,将不胜感激。
我编辑了原单后。 – 2012-04-20 09:12:18