This content is archived. See latest version here.

Last updated: Jan 15 2015

Content in EPiServer is mainly built up by models that contain properties that is used to store and present data. There are a number of built-in property types that can be used in your models. You also have the ability to create own property types. The most common property types used are as follows:

What you want to do

Solution

Editing experience

Hints and tips

Plain short text

String property

One row input

Use custom tag to control the containing tag, for instance using a H1 for the main header for the page. Use the StringLength attribute to control the allowed length.

Plain long text

String property with UIHint.Textarea

Text area

Use the StringLength attribute to control the allowed length.

Html

XHtmlString property

An TinyMCE HTML editor

 

Integer value

Int property

A number slider

Often used to control other rendering, for instance the number of items in a list. You can control the min and max values with the Range attribute.

Date and time

DateTime property

A date and time picker

You can control the min and max values with the Range attribute.

Double

Double property

Check editor

You can control the min and max values with the Range attribute.

Boolean

Boolean property

Check box

 

Page type

PageType property

 

Used to filter items in a list etc.

Form

XForm property

A form created by an editor

Renders a form that has been created by an editor.

 

BLOB

 

 

Used to hold binary data (for example, an image). A BLOB can be routed to with pattern <Url to content>/BlobPropertyName.

Working with other content

There are several different ways to refer to existing content. You can use the Link or LinkCollection to be able to create internal or external links. Content area to display content from other content or ContentReference / URL to link to a single content of a specified type. It is also possible to use the AllowedTypes attribute to further restrict which kind of links that are possible to add to a property although there are a few known limitations to this currently.

A content reference can be used with many different UI hints to select different entities in EPiServer, for instance: a block, a media item, a block folder, a media folder etc. There are also more hints in other EPiServer products like EPiServer Commerce.

What you want to do

Solution

Editing experience

Hints and tips

Link to a page

PageReference property

Content picker with
drag and drop support

 

Link to a media
file of any type

ContentReference property
with UIHint.MediaFile

Content picker with
drag and drop support

A link to any file in the media repository. Mostly for backwards compatibility. Use ContentReference instead to use standard content rendering.

Link to an image

ContentReference property
with UIHint.Image

Content picker with
drag and drop support

Enables the editor to select any content in the media repository implementing IContentImage.

Link to a video

ContentReference property
with UIHint.Video

Content picker with
drag and drop support

Enables the editor to select any content in the media repository implementing IContentVideo.

Link to a media
file with the 
possibility to
append additional information in
the URL

Url property with
UIHint.MediaFile or
UIHint.Image or
UIHint.Video

Content picker with
drag and drop support

Each link can be an item inside EPiServer, such as pages or media but also external URLs. Use URL instead of ContentReference if you want to be able to add additional information, for instance query string parameters to control size.

Content area

ContentArea property

   

URL

Url property

Link dialog with drag and drop support

 

Link Collection

LinkItemCollection 
property

Link collection editor with drag and drop support

Does not currently support the AllowedTypes attribute.

Selection of predefined values

The following can be used to create dropdown lists and checkbox lists:

What you want to do

Solution

Editing experience

Hints and tips

Select a single item from a relative short list of options

String/Int property with SelectOne attribute

Link to implementation
page

 

Select several items from a relative short list of options

String/Int property with SelectMany attribute

Link to implementation
page

 

Select a single item from a relative long list of options

String/Int property with AutoSuggestion attribute

Link to implementation
page

The auto-suggestion editor will create additional requests to the server, so use this with caution.

Validation attributes

EPiServer supports a number of validation attributes that are part of the .NET Framework, for example, the following:

  • Range
  • StringLength
  • RegularExpression
  • EmailAttribute

It is also possible to create custom attributes that implement either ValidationAttribute or IMetadataAware, refer to Restricting access to who is allowed to edit a property.

See also

Comments