Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Adding classes to Blazor(Razor) Validation

$
0
0

I know things are still pretty early in the Blazor development track, but I'm wondering if anyone has come across a way to apply classes to a Blazor (Razor) validation message? Here's a sample of code.

<EditForm Model="@Employee" OnValidSubmit="@HandleValidSubmit"><DataAnnotationsValidator /><ValidationSummary /><div class="form-group row"><label for="lastName" class="col-sm-3">Last Name: </label><div class="col-sm-8"><InputText id="lastName" @bind-Value="@Employee.LastName" class="form-control" placeholder="Enter last name" /><ValidationMessage For="@(() => Employee.LastName)" /></div></div>

I'd like to be able to add a text-danger, col-sm-8 or other classes to the validation message. I already know that I could do it with CSS using the default validation-error class.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>