API Reference: PrefixAttribute Class

The PrefixAttribute can be applied to content model properties. The attribute sets a prefix label to be displayed as part of a single line editor, for example, a textbox or numeric editor. This can be used to provide extra information about the nature of the value to be entered, such as a currency symbol for financial values.

Applying the attribute to a property with an editor that doesn't support PrefixAttribute has no effect.

Usage

Decorate the model property with the PrefixAttribute. Pass the prefix label in the attribute constructor. The prefix can be an HTML-encoded string.

Example

public class SampleContent: IContentType
{
    // Sets a euro symbol prefix to a numeric editor
    [Prefix("€")]
    public int MonthlyRate { get; set; }

    // Sets a http scheme prefix to a textbox editor
    [Prefix("http://")]
    public string DomainName { get; set; }

    // ...
}