Class RadzenCompareValidator
A validator component which compares a component value with a specified value. Must be placed inside a RadzenTemplateForm<TItem>
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenCompareValidator : ValidatorBase, IDisposable, IRadzenFormValidator
Examples
<RadzenTemplateForm TItem="Model" Data=@model>
<RadzenPassword style="display: block" Name="Password" @bind-Value=@model.Password />
<RadzenPassword style="display: block" Name="RepeatPassword" @bind-Value=@model.RepeatPassword />
<RadzenCompareValidator Value=@model.Password Component="RepeatPassword" Text="Passwords should be the same" Style="position: absolute" />
</RadzenTemplateForm>
@code {
class Model
{
public string Password { get; set; }
public double Value { get; set; }
public string RepeatPassword { get; set; }
}
Model model = new Model();
}
Properties
Operator
Specifies the comparison operator. Set to CompareOperator.Equal
by default.
Declaration
public CompareOperator Operator { get; set; }
Property Value
Type | Description |
---|---|
CompareOperator |
Text
Gets or sets the message displayed when the component is invalid. Set to "Value should match"
by default.
Declaration
public override string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
ValidateOnComponentValueChange
Gets or sets a value indicating whether this RadzenCompareValidator should be validated on value change of the specified Component.
Declaration
public virtual bool ValidateOnComponentValueChange { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Value
Specifies the value to compare with.
Declaration
public object Value { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
OnAfterRender(Boolean)
Declaration
protected override void OnAfterRender(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender |
SetParametersAsync(ParameterView)
Called by the Blazor runtime when parameters are set.
Declaration
public override async Task SetParametersAsync(ParameterView parameters)
Parameters
Type | Name | Description |
---|---|---|
ParameterView | parameters | The parameters. |
Returns
Type | Description |
---|---|
Task |
Overrides
Validate(IRadzenFormComponent)
Runs validation against the specified component.
Declaration
protected override bool Validate(IRadzenFormComponent component)
Parameters
Type | Name | Description |
---|---|---|
IRadzenFormComponent | component | The component to validate. |
Returns
Type | Description |
---|---|
System.Boolean |
|