Content fields

Content fields are pieces of information that can be added to a content type. Content fields have a name and a type and are specific to a content type.

For example, a Product content type can have a text field representing its Sku, a numeric field representing its price, and another numeric field representing its weight. Each of these fields probably only makes sense on a product.

Adding a field to a content type is as simple as defining a public property with a getter and setter. You should also annotate it with the PersistedAttribute as in the following example.

public class Product : Content {

public string Sku { get; set; }

Controlling the user interface

Lemoon automatically generates an administrative user interface for displaying and editing content items. You can control how the individual properties of a content type will be displayed end edited by adding additional attributes to the fields of your content type.

Lemoon has a number of built in controls (it is also possible to create your own UI control) that are capable of rendering fields of a specific data-type and style. These range from a simple textbox for a single-line string to controls capable of selecting multiple content items. The actual data type of the property (e.g. string, int, bool), the DataTypeAttribute and the UIHintAttribute determines how Lemoon renders the field.

public string StringField { get; set; }

Single line textbox.

public string TextAreaField { get; set; }

Multi line textbox.

public string HtmlField { get; set; }

Rich text editor for HTML.

public string SourceField { get; set; }

Code editor.

public string EmailField { get; set; }

Textbox with validator for email address.

public string UrlField { get; set; }

Textbox with validator for url.

public string PasswordField { get; set; }

Textbox with masked input for passwords.

public string HiddenField { get; set; }

Hidden field.

public bool BooleanField { get; set; }


public DateTime? DateTimeField { get; set; }

Date and time picker.

public DateTime? DateField { get; set; }

Date picker.

public DateTime? TimeField { get; set; }

Time picker.

public int? IntegerField { get; set; }

Textbox with validator for integers.

public double? DoubleField { get; set; }

Textbox with validator for decimal values.

[UIHint(null, null, "Item 1", "1", "Item 2", "2", "Item 3", "3")]
public string SelectField { get; set; }

Dropdown list.

[UIHint(null, null, "Item 1", "1", "Item 2", "2", "Item 3", "3")]
public List<string> SelectManyField { get; set; }

Select list. 

[UIHint(null, null, "Item 1", "1", "Item 2", "2", "Item 3", "3")]
public List<bool> CheckBoxesField { get; set; }

Checkbox list.

[UIHint(null, null, "Item 1", "1", "Item 2", "2", "Item 3", "3")]
public string RadioButtonsField { get; set; }

Radio button list.

public string UserControlField { get; set; }

Custom user control.

public string WebControlField { get; set; }

Custom web server control.

public ContentRef ContentPicker { get; set; }

Content picker.

public List<ContentRef> MultipleContentPicker { get; set; }

Multiple content picker

public ContentRef FilePicker { get; set; }

File picker

public List<ContentRef> MultipleFilePicker { get; set; }

Multiple file picker

public ContentRef FolderPicker { get; set; }

Folder picker

public List<ContentRef> MultipleFolderPicker { get; set; }

Multiple folder picker

public ContentRef PagePicker { get; set; }

Page picker

public List<ContentRef> MultiplePagesPicker { get; set; }

Multiple page picker.

public UserRef UserPicker { get; set; }

User picker.

public List<UserRef> MultipleUserPicker { get; set; }

Multiple user picker.

public RoleRef RolePicker { get; set; }

Role picker.

public List<RoleRef> MultipleRolePicker { get; set; }

Multiple role picker.