我想在内容区域中显示项目列表(我正在使用页面列表块来显示页面列表。)当我将页面类型拖放到内容区域中时,我收到一条错误消息“Castle.Proxies。列表块代理”。
下面是我的代码....
主页块页面.cs
public class HomeBlocksPage : SitePageData
{
[Display(Name = "Main Listing", Description = "A listing of news pages", GroupName = SystemTabNames.Content, Order = 315)]
public virtual ListingBlock MainListing { get; set; }
}
查看模型类-ListingBlockModel.cs
public class ListingBlockModel
{
public ContentReference PageImage { get; set; }
public IEnumerable<SitePageData> Items { get; set; }
}
ListingBlock的Index.cshtml
@if (Model.Items != null) {
foreach (var item in Model.Items)
{
<div class="list">
<p><img src="@Url.ContentUrl(item.PageImage)"/></p>
<h3>@Html.PageLink(item)</h3>
@if (item.Property["MainBody"] != null)
{
@item.Property["MainBody"].Value
}
<hr />
</div>
} }
为了在内容区域中显示或呈现项目列表(页面列表),我为页面创建了部分模板。
PagePartialController.cs
[TemplateDescriptor(Inherited = true)]
public class PagePartialController : PartialContentController<HomeBlocksPage>
{
public override ActionResult Index(HomeBlocksPage currentContent)
{
return PartialView("/Views/Shared/PagePartials/PagePartial.cshtml",currentContent);
}
}
PagePartial.cshtml
@model WesleyanSite.Models.Pages.HomeBlocksPage
<div class="span12">
<a href="@Url.PageUrl(Model.LinkURL)">
@Model.MainListing
</a>
</div>
当我在编辑模式下将页面拖放到内容区域时,出现“Castle.Proxies.ListingBlockProxy”错误