Table of Contents

Class ValidatorBase

Namespace
Radzen.Blazor
Assembly
Radzen.Blazor.dll

Base class of Radzen validator components.

public abstract class ValidatorBase : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormValidator
Inheritance
ValidatorBase
Implements
Derived
Inherited Members

Constructors

ValidatorBase()

protected ValidatorBase()

Fields

messages

Stores the validation messages.

protected ValidationMessageStore messages

Field Value

ValidationMessageStore

Properties

Component

Specifies the component which this validator should validate. Must be set to the Name of an existing component.

[Parameter]
public string Component { get; set; }

Property Value

string

EditContext

Provided by the RadzenTemplateForm<TItem> which contains this validator. Used internally.

[CascadingParameter]
public EditContext EditContext { get; set; }

Property Value

EditContext

The edit context.

Form

Gets or sets the form which contains this validator.

[CascadingParameter]
public IRadzenForm Form { get; set; }

Property Value

IRadzenForm

IsValid

Returns the validity status.

public bool IsValid { get; protected set; }

Property Value

bool

true if this validator is valid; otherwise, false.

Popup

Determines if the validator is displayed as a popup or not. Set to false by default.

[Parameter]
public bool Popup { get; set; }

Property Value

bool

Text

Specifies the message displayed when the validator is invalid.

[Parameter]
public abstract string Text { get; set; }

Property Value

string

Methods

BuildRenderTree(RenderTreeBuilder)

protected override void BuildRenderTree(RenderTreeBuilder builder)

Parameters

builder RenderTreeBuilder

Dispose()

public override void Dispose()

GetComponentCssClass()

protected override string GetComponentCssClass()

Returns

string

SetParametersAsync(ParameterView)

public override Task SetParametersAsync(ParameterView parameters)

Parameters

parameters ParameterView

Returns

Task

Validate(IRadzenFormComponent)

Runs validation against the specified component.

protected abstract bool Validate(IRadzenFormComponent component)

Parameters

component IRadzenFormComponent

The component to validate.

Returns

bool

true if validation is successful, false otherwise.