Skip to main content
All docs
V25.1
  • Tab

    CheckBoxProperties.CheckedIsValidOnly Property

    Specifies whether only the checked state is valid.

    Namespace: DevExpress.Web

    Assembly: DevExpress.Web.v25.1.dll

    NuGet Package: DevExpress.Web

    Declaration

    [DefaultValue(false)]
    public bool CheckedIsValidOnly { get; set; }

    Property Value

    Type Default Description
    Boolean false

    true if only the checked state is valid; otherwise, false.

    Remarks

    The CheckBoxProperties.CheckedIsValidOnly property is in effect for a column that displays Boolean values. Set this property to true to specify that only the checked state is valid for the built-in ASPxCheckBox editor. In this case, the editor validates check states automatically, so you do not need to define the check box as a required field to enable its validation.

    When the CheckBoxProperties.CheckedIsValidOnly property value is false or not specified, the IsRequired property defines whether the built-in check box validates its input. With this technique, a validation error occurs for the grayed state only (the checked and unchecked states are valid).

    Web Forms Example

    <dx:ASPxGridView ID="ASPxGridView1" runat="server">
        <!--...-->
        <Columns>
            <!--...-->
            <dx:GridViewDataCheckColumn FieldName="Discontinued">
                <PropertiesCheckEdit AllowGrayed="true" CheckedIsValidOnly="true" />
            </dx:GridViewDataCheckColumn>
        </Columns>
    </dx:ASPxGridView>
    

    MVC Example

    @Html.DevExpress().GridView(settings => {
        settings.Name = "MVCxGridView1";
        //...
        settings.Columns.Add(c => {
            c.FieldName = "Discontinued";
            c.ColumnType = MVCxGridViewColumnType.CheckBox;
            CheckBoxProperties checkBoxSettings = new CheckBoxProperties 
            { 
                AllowGrayed = true, 
                CheckedIsValidOnly = true 
            };
            c.PropertiesEdit.Assign(checkBoxSettings);
        });
    }).Bind(Model).GetHtml()
    
    See Also