Wie kann ich überprüfen, ob ein Benutzer mindestens ein Kontrollkästchen in einer CheckBoxList aktiviert hat?

Ich habe ein CheckBoxList-Steuerelement, von dem ich möchte, dass der Benutzer mindestens EIN Kästchen ankreuzt. Es spielt keine Rolle, ob sie jedes einzelne oder drei oder nur eines ankreuzen.

Was kann ich im Sinne der Validierungskontrollen von asp.net verwenden, um dies zu erzwingen? Ich verwende auch den Ajax-Validierungs-Extender, daher wäre es schön, wenn er wie andere Steuerelemente und nicht wie eine kitschige Server-Validierungsmethode im Codebehind aussehen könnte.

<asp:CheckBoxList RepeatDirection="Horizontal" RepeatLayout="Table" RepeatColumns="3" ID="ckBoxListReasons" runat="server">
    <asp:ListItem Text="Preliminary Construction" Value="prelim_construction" />
    <asp:ListItem Text="Final Construction" Value="final_construction" />
    <asp:ListItem Text="Construction Alteration" Value="construction_alteration" />
    <asp:ListItem Text="Remodel" Value="remodel" />
    <asp:ListItem Text="Color" Value="color" />
    <asp:ListItem Text="Brick" Value="brick" />
    <asp:ListItem Text="Exterior Lighting" Value="exterior_lighting" />
    <asp:ListItem Text="Deck/Patio/Flatwork" Value="deck_patio_flatwork" />
    <asp:ListItem Text="Fence/Screening" Value="fence_screening" />
    <asp:ListItem Text="Landscape - Front" Value="landscape_front" />
    <asp:ListItem Text="Landscape - Side/Rear" Value="landscape_side_rear" />
    <asp:ListItem Text="Other" Value="other" />
</asp:CheckBoxList>

Antworten auf die Frage(6)

Ihre Antwort auf die Frage