Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxCheckBox<T>.InputId Property

Specifies a unique identifier (ID) of the CheckBox’s input element.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public string InputId { get; set; }

#Property Value

Type Description
String

A unique identifier.

#Remarks

The InputId property value is assigned to the id attribute of the CheckBox’s input element. The id is case-sensitive, should contain at least one character, and should not contain whitespaces (spaces, tabs, etc.)

When you create a Form Layout component and add the CheckBox to a layout item’s template, use the InputId property to associate the the CheckBox with the layout item’s caption.

  • Specify the layout item’s Caption property. A browser renders the caption as an HTML label element.
  • Set the layout item’s CaptionFor property to a unique value. This value is assigned to the label’s for attribute.
  • Set the editor’s InputId property to the same value as the item’s CaptionFor.

Note

If you do not specify the CaptionFor property, the Form Layout generates a random identifier (Guid ) and assigns it to the label’s for attribute and to the id property of the first input element in the template.

Razor
<DxFormLayout>
    @*...*@
    <DxFormLayoutItem Caption="On Vacation:" CaptionFor="check_box">
        <Template>
            <DxCheckBox @bind-Checked="@OnVacation" InputId="check_box"></DxCheckBox>
        </Template>
    </DxFormLayoutItem>
</DxFormLayout>

@code {
    // ...
    bool OnVacation { get; set; } = true;
}

You can click the associated label to focus/check/uncheck the checkbox.

See Also