【发布时间】:2011-03-11 11:55:16
【问题描述】:
在 N2 CMS 上工作,我正在添加自己的内容类型 Product。我从 ContentPageBase 派生了我的 Product 类,我可以将它添加到内容树中。然而,当我编辑一个项目时,这些字段似乎是反转的(Title 和Text)。对于所有示例项目(例如News),Title 始终显示在顶部。
我知道有一个 ContainerName 属性可以设置为 tabname,但是我在 @ 中没有看到 Title 或 Text 的任何属性覆盖987654332@class,怎么会这样呢?
编辑新闻项目
编辑产品
Product.cs(自定义)
using N2;
using N2.Web;
using N2.Details;
using N2.Integrity;
namespace N2.Templates.Mvc.Models.Pages
{
/// <summary>
/// This class represents the data transfer object that encapsulates
/// the information used by the template.
/// </summary>
[PageDefinition("Product")]
[WithEditableTitle, WithEditableName]
[RestrictParents(typeof(ProductSection),typeof(ProductCategory))]
public class Product : ContentPageBase
{
}
}
News.cs(默认)
using System.Web.UI.WebControls;
using N2.Definitions;
using N2.Details;
using N2.Integrity;
using N2.Templates.Mvc.Services;
using N2.Web.Mvc;
using N2.Persistence;
namespace N2.Templates.Mvc.Models.Pages
{
[PageDefinition("News", Description = "A news page.", SortOrder = 155,
IconUrl = "~/Content/Img/newspaper.png")]
[RestrictParents(typeof (NewsContainer))]
public class News : ContentPageBase, ISyndicatable
{
public News()
{
Visible = false;
Syndicate = true;
}
[EditableTextBox("Introduction", 90, ContainerName = Tabs.Content, TextMode = TextBoxMode.MultiLine, Rows = 4,
Columns = 80)]
public virtual string Introduction
{
get { return (string) (GetDetail("Introduction") ?? string.Empty); }
set { SetDetail("Introduction", value, string.Empty); }
}
string ISyndicatable.Summary
{
get { return Introduction; }
}
[Persistable(PersistAs = PropertyPersistenceLocation.Detail)]
public virtual bool Syndicate { get; set; }
}
}
【问题讨论】:
标签: asp.net-mvc n2 n2cms