|
Attributes
The N2 attributes you can decorate your classes with
Below is a reference for the attributes you can decorate your custom content classes with in N2. More detailed information can be found in the N2.Details API documentation. Attributes for properties and classes are in N2.dll, found inside the following namespaces:
Class attributesTo save yourself the hassle of adding extra properties and attributes to those properties for the name and title of your content item, you should add the following two attributes to your class: WithEditableName WithEditableTitle Without these you are responsible for making sure the page names are unique and have no bad letters in them. Without a title, nothing is displayed in the treeview for each item's name. To enable you pages to be useable in the installer for root/start nodes, make sure you add: Installer = InstallerHint.PreferredRootPage
Installer = InstallerHint.PreferredStartPagein the Definition Attribute, e.g. [Definition("Basic page", "BasicPage","A simple page with a chunk of text","The tooltip",1, Installer = InstallerHint.PreferredStartPage)]All attributes available: AllowedChildren
AllowedZones
AvailableZone
Definition
ItemAuthorizedRoles
RestrictParents
Template
WithEditable - sets a detail as editable so parent class properties that aren't editable can be.
WithEditableChild
WithEditableDateRange
WithEditableName
WithEditablePublishedRange
WithEditableTitleExample usage: [AllowedChildren(typeof(BasicPage))]
[AllowedZones("zone name")]
[AvailableZone("title","zone name")]
[Definition("title","name",Description="description",SortOrder=1,ToolTip="tooltip", Installer = InstallerHint.PreferredRootPage)]
[ItemAuthorizedRoles("role name1","role name")]
[RestrictParents(typeof(BasicPage)]
[Template("~/Custom/Views/BasicPage.aspx")]
[WithEditable("title",typeof(TextBox),"propertyname",1,"name")]
[WithEditableChild(typeof(ChildItem),"child name",1)]
[WithEditableDateRange("Date range title",2,"start date","end date")]
[WithEditableName("title",1])
[WithEditablePublishedRange("Available between",3)]
[WithEditableTitle("title",2)]
public class MyItem : ContentItem {}Properties ItemAuthorizedRoles
DetailAuthorizedRoles
Editable
EditableFreeTextArea
EditableItem
EditableTextBox
EditableUrl
EditableUserControl
EditorModifierBoth class and properties AbstractDisplayable
AbstractEditable
ReplaceDefinitions ??
ReplacesParentDefinition ??
ControlAssociation
Disable
DisplayableAnchor
DisplayableImage
DisplayableLiteral
EditableChildren
EditableDropDown
EditableImage
EditableItem
EditableLanguagesDropDown
EditableLink
EditableListControl
EditableEnum
AdministrativePlugin
TypeIntegrity
TabContainer
FieldSetContainer
[EditableTextBox("Text",3,TextMode=TextBoxMode.MultiLine)]
public string Text
{
get { return (string)GetDetail("Text"); }
set { SetDetail("Text", value); }
}
|