All docs
V18.2
20.2 (EAP/Beta)
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
18.1
17.2

Overview - CheckBox

  • 2 minutes to read

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

Implementation Details

CheckBox is realized by the CheckBoxExtension class. Its instance can be accessed via the ExtensionsFactory.CheckBox helper method, which is used to add a CheckBox extension to a view. This method's parameter provides access to the CheckBox's settings implemented by the CheckBoxSettings class, allowing you to fully customize the extension.

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

Declaration

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

View code (ASPX):

<% 
    Html.DevExpress().CheckBox(
        settings => {
            settings.Name = "checkBox1";
            settings.Checked = true;
            settings.Text = "Show button";
            settings.Properties.ClientSideEvents.CheckedChanged = "function (s, e){ myButton.SetVisible(!myButton.GetVisible());}";
        }
    )
    .Render();
%> 

<% 
    Html.DevExpress().Button(
        settings => {
            settings.Name = "myButton";
            settings.EnableClientSideAPI = true;
        }
    )
    .Render();
%> 

View code (Razor):

@Html.DevExpress().CheckBox(
    settings => {
        settings.Name = "checkBox1";
        settings.Checked = true;
        settings.Text = "Show button";
        settings.Properties.ClientSideEvents.CheckedChanged = "function (s, e){ myButton.SetVisible(!myButton.GetVisible());}";
    }
).GetHtml()

@Html.DevExpress().Button(
    settings => {
        settings.Name = "myButton";
        settings.EnableClientSideAPI = true;
    }
).GetHtml()
NOTE

The Partial View should contain only the extension's code.

The code result is demonstrated in the image below.

checkbox-declaration.png

See Also