Class RadzenCompareValidator
A validator component which compares a component value with a specified value. Must be placed inside a RadzenTemplateForm<TItem>
public class RadzenCompareValidator : ValidatorBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormValidator
- Inheritance
-
RadzenCompareValidator
- Implements
- Inherited Members
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();
}
Constructors
RadzenCompareValidator()
public RadzenCompareValidator()
Properties
Operator
Specifies the comparison operator. Set to CompareOperator.Equal
by default.
[Parameter]
public CompareOperator Operator { get; set; }
Property Value
Text
Gets or sets the message displayed when the component is invalid. Set to "Value should match"
by default.
[Parameter]
public override string Text { get; set; }
Property Value
ValidateOnComponentValueChange
Gets or sets a value indicating whether this RadzenCompareValidator should be validated on value change of the specified Component.
[Parameter]
public virtual bool ValidateOnComponentValueChange { get; set; }
Property Value
- bool
true
if should be validated; otherwise,false
.
Value
Specifies the value to compare with.
[Parameter]
public object Value { get; set; }
Property Value
Methods
OnAfterRender(bool)
protected override void OnAfterRender(bool firstRender)
Parameters
firstRender
bool
SetParametersAsync(ParameterView)
public override Task SetParametersAsync(ParameterView parameters)
Parameters
parameters
ParameterView
Returns
Validate(IRadzenFormComponent)
protected override bool Validate(IRadzenFormComponent component)
Parameters
component
IRadzenFormComponent