0
我想在我的視圖內的foreach循環中呈現圖像。但即使Model有不同的圖像,它也會顯示相同的圖像。 我的視圖代碼:在Sitecore中使用Glassmapper映射圖像
@foreach (var currentFeature in Model.FacilityFeatures)
{
<li class="features-list-enclosure">
<span title="@currentFeature.CategoryName" class="features-list-enclosure__item">
@RenderImage(x => currentFeature.CategoryICON, new { title = @currentFeature.CategoryName }, isEditable: true)
</span>
</li>
}
我的模型:
public class FacilitiesPage : BasePage
{
[SitecoreField(FieldName = "Facility features")]
public virtual IEnumerable<ContentCategory> FacilityFeatures { get; set; }
}
當我運行調試器則顯示出currentFeature.CategoryICON項目在每次循環得到了不同的圖像。但它在用戶界面上顯示相同的圖像,但圖像上的標題不同。 如果我不使用Glassmapper渲染圖像比它的工作原理,並顯示不同的圖像:
@foreach (var currentFeature in Model.FacilityFeatures)
{
<li class="features-list-enclosure">
<span title="@currentFeature.CategoryName" class="features-list-enclosure__item">
<img title="@currentFeature.CategoryName" src="@currentFeature.CategoryICON.Src" />
</span>
</li>
}
謝謝..它的工作.. :) –