Back to Devexpress

DxHtmlEditor.ValidationMessagePosition Property

blazor-devexpress-dot-blazor-dot-dxhtmleditor-481d2118.md

latest3.4 KB
Original Source

DxHtmlEditor.ValidationMessagePosition Property

Specifies where the editor displays a validation message.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[DefaultValue(HtmlEditorValidationMessagePosition.Bottom)]
[Parameter]
public HtmlEditorValidationMessagePosition ValidationMessagePosition { get; set; }

Property Value

TypeDefaultDescription
HtmlEditorValidationMessagePositionBottom

An enumeration value.

|

Available values:

NameDescriptionImage
Bottom

Bottom position.

|

| | Top |

Top position.

|

| | Left |

Left position.

|

| | Right |

Right position.

|

|

Remarks

<DxHtmlEditor> allows you to validate user input. To specify validation rules, use the IsValid property.

When a user enters an invalid value, the editor displays a validation message at the bottom editor edge. To change message position, use the ValidationMessagePosition property.

Note

<DxHtmlEditor> displays a validation message outside the editor area. To display a message correctly, adjust the editor size (Height and Width properties) or add margins.

Example

The following code snippet validates user input in the MarkupChanged event handler and configures validation settings as follows:

  • Displays a validation message if the editor’s markup is empty.
  • Sets the validation message text.
  • Positions the validation message at the right editor edge.

razor
<DxHtmlEditor Markup="@markup"
              IsValid="@isValid"
              ValidationMessage="Empty markup."
              ValidationMessagePosition="HtmlEditorValidationMessagePosition.Right"
              MarkupChanged="@OnMarkupChanged"
              Height="100px"
              Width="80%" />

@code {
    bool isValid;
    string markup { get; set; } = "";
    void OnMarkupChanged(string newValue) {
        markup = newValue;
        isValid = !string.IsNullOrEmpty(newValue);
    }
}

See Also

DxHtmlEditor Class

DxHtmlEditor Members

DevExpress.Blazor Namespace