Boolean

Das Boolean-EditorTemplate rendert einen bool? als Ja/Nein-Auswahl. Einbindung über @Html.EditorFor(...) mit [UIHint("Boolean")].

Boolean

bool? als Ja/Nein-Auswahl.

@model BooleanBeispielViewModel

<form class="fmh-demo-form">
    @Html.EditorFor(m => m.Aktiv)
</form>
using System.ComponentModel.DataAnnotations;

namespace FMH.Komponente.WebUI.Areas.Basis.Models
{
    public class BooleanBeispielViewModel
    {
        [Display(Name = "Aktiv")]
        [UIHint("Boolean")]
        public bool? Aktiv { get; set; } = true;
    }
}

Darstellung

Das Boolean-EditorTemplate rendert einen bool? als Ja/Nein-Auswahl. Eingebunden über Html.EditorFor mit [UIHint("Boolean")].

[Display(Name = "Aktiv")]
[UIHint("Boolean")]
public bool? Aktiv { get; set; }

Weitere Konfigurationen

Konfiguration Wirkung
[Display(Name = "…")] Beschriftung
[Required] / [RequiredIf] Pflichtauswahl
[HelpText(Name = "…")] Ergänzender Hilfetext