How can i change my validation message in the following code:
<label class="form-label"> Prenom</label>
<InputText style="width:700px;" class="form-control" @bind-Value="RegisterModel.Prenom"></InputText>
<ValidationMessage For="@(() => RegisterModel.Prenom)" />
Hi @Alex_Tremblay,
You don't seem to be using any Radzen.Blazor components in those snippets. If you use RadzenRequiredValidator you can change the message via its Text
attribute:
<RadzenTextBox Name="FirstName" @bind-Value=@model.FirstName />
<RadzenRequiredValidator Component="FirstName" Text="First name is required" />
For the built-in Blazor ValidationMessage you would need to change the [Required]
attribute of your model.
public class RegisterModel
{
[Required(ErrorMessage = "please enter {0}")]
public string Prenom { get; set; }
}