ASPxCheckBox.CheckedIsValidOnly Property
Specifies whether only the checked state is valid.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | false |
|
Remarks
Set the CheckedIsValidOnly
property to true
to specify that only the checked state is valid. In this case, ASPxCheckBox validates check states automatically, so you do not need to define the editor as a required field to enable its validation.
When the CheckedIsValidOnly
property value is false
or not specified, the IsRequired property defines whether the 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:ASPxCheckBox ID="ASPxCheckBox1" runat="server" AllowGrayed="true" CheckedIsValidOnly="true" />
MVC Example
@Html.DevExpress().CheckBox(settings =>
{
settings.Name = "MVCxCheckBox1";
settings.Properties.AllowGrayed = true;
settings.Properties.CheckedIsValidOnly = true;
}).Bind(Model).GetHtml()
Instead of the CheckedIsValidOnly
property, you can specify the CheckBoxRequiredAttribute.ValidStateMode property to define valid check states. Use only one of these properties to avoid conflicts between them.