CheckBoxFor

CheckBoxFor represents a check editor that allows the end user to make a selection, such as true/false or yes/no.

Implementation Details

CheckBoxFor is realized by the CheckBoxExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.CheckBoxFor<ValueType> strongly typed helper method, which is used to add a CheckBoxFor extension to a view. This first method's parameter is an expression that identifies model property to display and edit. The second method's parameter provides access to the CheckBoxFor's settings implemented by the CheckBoxSettings class, allowing you to fully customize the extension.

CheckBoxFor's client counterpart is represented by the ASPxClientCheckBox object.

Declaration

CheckBoxFor can be added to a view in the following manner.

View code (Razor):

@Html.DevExpress().CheckBoxFor(model => model.IsActive,
    settings => {
        settings.Text = "The account is active";
    }
).GetHtml()

The code result is demonstrated in the image below.

MVC_CheckBoxFor_Declaration.png

See Also