Hide

YetaWF Documentation

Display
Print

Enum Component

Enum (Display)

Displays the model formatted using the descriptive text found in the EnumDescription attribute (if present). The model is an enumeration (enum).

Model Type: object

AdditionalMetadata Attributes

NameTypeDefaultDescription
ShowEnumValuebooltrueIf true, the enum value is displayed along with the descriptive text for the enum. Otherwise, the value of the enum is not displayed. In either case, enum values are only shown if the user's User Settings (see User > Settings, standard YetaWF site) has the ShowEnumValue property set to true. AdditionalMetadata("ShowEnumValue", false) is normally used in grids to explicitly suppress the enum value so only the descriptive text is shown.
public enum LevelEnum {
    [EnumDescription("Info", "Informational")]
    Info = 0,
    [EnumDescription("Error", "Error")]
    Error = 99,
}

[Caption("Level"), Description("The error level of this log record")]
[UIHint("Enum"), AdditionalMetadata("ShowEnumValue", false), ReadOnly]
public LevelEnum Level { get; set; }

Enum (Edit)

Allows selection of an enum value using a dropdown list which is created based on the enum type and the EnumDescription attributes (if present).

Model Type: object

Enum values are only shown if the user's User Settings (see User > Settings, standard YetaWF site) has the ShowEnumValue property set to true.

AdditionalMetadata Attributes

NameTypeDefaultDescription
ShowSelectboolfalseIf true, an entry showing "(select)" with a value of 0 is inserted as the first entry, in addition to all enum values. Otherwise, only the enum values are shown.