Table of Contents

Class ExampleNewsItem

Namespace
Dynamicweb.Examples.Items
Assembly
Dynamicweb.Examples.dll
[Item("News item", "The example of code-first item")]
[AreaRule]
[ModuleAttachmentRule(true)]
[StructureRule(new StructureContextType[] { StructureContextType.Pages, StructureContextType.Paragraphs })]
[ParentRule(new ParentRestrictionRule.ParentType[] { ParentRestrictionRule.ParentType.RootOfWebsite, ParentRestrictionRule.ParentType.RegularPage })]
[ChildRule(true)]
[ChildRule(new string[] { "ExampleCategory", "ExampleRegion" })]
[Category("Example")]
[Icon(KnownIcon.Message)]
[TitleField("Title")]
public class ExampleNewsItem : ItemEntry
Inheritance
ExampleNewsItem
Inherited Members

Constructors

ExampleNewsItem()

public ExampleNewsItem()

Properties

BackgroundColor

[Group("StandardFields")]
[Color("Background color", Presets = "#FFF, #151515, #444544, #5E5E5E, #005731, #287D59, #31988D, #2D73AB, #384E9A, #703F96, #9F3F95, #A93948, #E6A04B, #DD823A, #9BBF53, #0085CA, #1C588F")]
[DefaultValue("#151515")]
public string BackgroundColor { get; set; }

Property Value

string

GoogleFont

[Group("StandardFields")]
[GoogleFont("Google font", "Lato", "italic")]
public string GoogleFont { get; set; }

Property Value

string

LandingPage

[Group("StandardFields")]
[Name("Link to landing page")]
[Link]
public string LandingPage { get; set; }

Property Value

string

NewsCategoryId

[Group("MappingFields", LayoutGroupMetadata.GroupCollapsibleState.Collapsed)]
[Field("Category", typeof(DropDownListEditor<string>))]
[OptionItem("ExampleCategory", "Name", "Id", SourceType = FieldOptionItemSourceType.CurrentArea)]
public string NewsCategoryId { get; set; }

Property Value

string

NewsDate

[Group("StandardFields")]
[Name("News date")]
[DefaultValue("Now")]
public DateTime NewsDate { get; set; }

Property Value

DateTime

NewsType

[Group("StandardFields")]
[Field("Type", typeof(RadioButtonListEditor<string>))]
[Option("News")]
[Option("Featured")]
[Option("Add")]
[DefaultValue("News")]
[Required]
public string NewsType { get; set; }

Property Value

string

Rank

[Group("Misc")]
[InputHtml5("Rank", InputType = "Number", Min = 0, Max = 10)]
[Validate(typeof(RegExValidator), Parameters = "Expression=^$|^[0-9]%2b")]
public int Rank { get; set; }

Property Value

int

RegionId

[Group("MappingFields")]
[Field("Region", typeof(CheckboxListEditor<string>))]
[OptionItem("ExampleRegion", "Name", "Id", SourceType = FieldOptionItemSourceType.CurrentArea)]
public IEnumerable<string> RegionId { get; set; }

Property Value

IEnumerable<string>

RelatedNews

[Group("Misc")]
[ItemRelationList("Related news", "ExampleNewsItem", ItemRelationListEditor.ItemListSource.Page, new string[] { "Title", "SubTitle" })]
[Option("Title")]
[Option("Subtitle")]
[Option("NewsType")]
public int RelatedNews { get; set; }

Property Value

int

Subtitle

[Group("StandardFields")]
[Name("Subtitle")]
public string Subtitle { get; set; }

Property Value

string

Tags

[Group("Misc", LayoutGroupMetadata.GroupCollapsibleState.None, "NewsType", GroupVisibilityRule.VisibilityCondition.NotEqualTo, "Featured")]
[Name("Tags")]
[LongText]
public string Tags { get; set; }

Property Value

string

Tags2

[Group("Misc2", LayoutGroupMetadata.GroupCollapsibleState.None, "NewsType", GroupVisibilityRule.VisibilityCondition.Equals, "Featured")]
[Name("Tags2")]
[LongText]
public string Tags2 { get; set; }

Property Value

string

Text

[Group("StandardFields")]
[Required]
[RichText]
public string Text { get; set; }

Property Value

string

Title

[Group("StandardFields")]
[Required]
public string Title { get; set; }

Property Value

string

Methods

Delete(ItemContext)

Deletes the curren item.
public override void Delete(ItemContext context)

Parameters

context ItemContext

Exceptions

InvalidOperationException
Cannot resolve the system name for the given item type.
To top