Class RadzenRequiredValidator
A validator component which checks if a component has value. Must be placed inside a RadzenTemplateForm<TItem>
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenRequiredValidator : ValidatorBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormValidator
Examples
<RadzenTemplateForm TItem="Model" Data=@model>
<RadzenTextBox style="display: block" Name="Email" @bind-Value=@model.Email />
<RadzenRequiredValidator Component="Email" Text="Email is required" Style="position: absolute" />
</RadzenTemplateForm>
@code {
class Model
{
public string Email { get; set; }
}
Model model = new Model();
}
Constructors
RadzenRequiredValidator()
A validator component which checks if a component has value. Must be placed inside a RadzenTemplateForm<TItem>
Declaration
public RadzenRequiredValidator()
Examples
<RadzenTemplateForm TItem="Model" Data=@model>
<RadzenTextBox style="display: block" Name="Email" @bind-Value=@model.Email />
<RadzenRequiredValidator Component="Email" Text="Email is required" Style="position: absolute" />
</RadzenTemplateForm>
@code {
class Model
{
public string Email { get; set; }
}
Model model = new Model();
}
Properties
DefaultValue
Specifies a default value. If the component value is equal to DefaultValue
it is considered invalid.
Declaration
[Parameter]
public object DefaultValue { get; set; }
Property Value
Type | Description |
---|---|
object |
Text
Gets or sets the message displayed when the component is invalid. Set to "Required"
by default.
Declaration
[Parameter]
public override string Text { get; set; }
Property Value
Type | Description |
---|---|
string |
Overrides
Methods
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 |
---|---|
bool |
|