Skip to main content

CheckBoxListFor

CheckBoxListFor represents a list of check boxes that allows the end user to select them.

Implementation Details

CheckBoxListFor is realized by the CheckBoxListExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.CheckBoxListFor<ValueType> helper method, which is used to add a CheckBoxListFor 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 CheckBoxListFor‘s settings implemented by the CheckBoxListSettings class, allowing you to fully customize the extension.

CheckBoxListFor‘s client counterpart is represented by the ASPxClientCheckBoxList object.

Declaration

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

@Html.DevExpress().CheckBoxListFor(model => model.ProgrammingLanguages,
    settings => {
        settings.Properties.RepeatLayout = options.RepeatLayout;
        settings.Properties.RepeatDirection = options.RepeatDirection;
        settings.Properties.RepeatColumns = options.RepeatColumns; 
    }).BindToXML(HttpContext.Current.Server.MapPath("~/App_Data/ProgLanguages.xml"), "//Language").GetHtml()

The code result is demonstrated in the image below.

CheckBoxList_view

See Also