RequiredFieldValidationPattern.IsRequired Property
Gets or sets a value that specifies whether the editor is a required field.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | false |
|
Remarks
Note
When a grid-based control is in Batch Edit mode, set the Display property to Dynamic, so as not to render the empty space (the validation error element) near the edit cell.
Web Forms:
...
<dx:GridViewDataComboBoxColumn FieldName="Answer">
<PropertiesComboBox>
...
<ValidationSettings Display="Dynamic">
<RequiredField IsRequired="true" />
</ValidationSettings>
</PropertiesComboBox>
</dx:GridViewDataComboBoxColumn>
...
MVC:
settings.CellEditorInitialize = (s, e) => {
ASPxEdit editor = (ASPxEdit)e.Editor;
editor.ValidationSettings.Display = Display.Dynamic;
};
Online Example
Example
function OnValidationCompleted(s, e) {
if(e.isValid && Password.GetValue() != ConfirmedPassword.GetValue()) {
ConfirmedPassword.SetFocus();
ErrorMessageNotEqual.SetVisible(true);
e.isValid = false;
} else
ErrorMessageNotEqual.SetVisible(false);
}
<script runat="server">
protected void Page_Load(object sender, EventArgs e) {
}
protected void ASPxGlobalEvents1_ValidationCompleted(object sender,
DevExpress.Web.ValidationCompletedEventArgs e) {
lErrorMessageNotEqual.ClientVisible
= !tbPassword.Value.Equals(tbConfirmedPassword.Value);
}
</script>
...
Type password:<br/>
<dxe:ASPxTextBox ID="tbPassword" runat="server" Width="170px"
ClientInstanceName="Password" Password="True">
<ValidationSettings SetFocusOnError="true">
<RequiredField IsRequired="True" />
</ValidationSettings>
</dxe:ASPxTextBox>
<br/>
Confirm password:
<dxe:ASPxTextBox ID="tbConfirmedPassword" runat="server" Width="170px"
ClientInstanceName="ConfirmedPassword" Password="True">
<ValidationSettings SetFocusOnError="true">
<RequiredField IsRequired="True" />
</ValidationSettings>
</dxe:ASPxTextBox>
...
See Also