Built-in property types
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 |
|
Link to a media |
ContentReference property |
Content picker with |
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 |
Content picker with |
Enables the editor to select any content in the media repository implementing IContentImage. |
Link to a video |
ContentReference property |
Content picker with |
Enables the editor to select any content in the media repository implementing IContentVideo. |
Link to a media |
Url property with |
Content picker with |
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 |
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 |
|
Select several items from a relative short list of options |
String/Int property with SelectMany attribute |
Link to implementation |
|
Select a single item from a relative long list of options |
String/Int property with AutoSuggestion attribute |
Link to implementation |
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
Last updated: Mar 31, 2014