Textbox Editor

The textbox editor is the property editor that you will likely use the most in your content models. It renders a plain single line or multiline text input.


You do not have to specify the textbox editor for string property types. If you want to force the textbox editor for non-string types, you can use the EditorAttribute attribute. The textbox editor can be further configured by decorating the property with attributes. See below for some examples and which attributes apply to the textbox editor.


The following example demonstrates textbox editor configuration.

public class SampleContent: IContentModel
    // By convention; single line text input, not required.
    public string Title { get; set; }

    // Required single line text input with custom validation message.
    [Required("Please enter the required text.")]
    public string RequiredText { get; set; }

    // Multiline textarea, not resizable.
    [Multiline(NoResize = true)]
    public string IntroText { get; set; }

    // Multiline textarea, maximum length 500 characters.
    public string ParagraphText { get; set; }

    // Single line 200 pixel text input with regular expression and prefix to the left.
    public string EmailAddress { get; set; }

Default Convention

The textbox editor is the default editor for string property types. Without any other configuration, a single line text input will be displayed in the back office. The input will have no validation.


The following attributes can be applied to the content model property to change the behaviour of the textbox editor.