Relative Content

Tag Archive for c#validationblazor-server-side

Blazor – Validate datalist from child component

I have written a Blazor testapp that has an EditForm with a child component in the parent component.
The child component consists of an input with type search for a datalist.
A method returns a result from the list with @oninput. The selection is returned to the parent via EventCallback using @focusout Event and can be saved in an object with the other inputs in the parent EditForm using Submit.
As soon as the validation is active, I would check the return value of the child component and set Validation = true with string.NotEmptyOrWhitespace(value) == false.
Can someone please tell me how I can implement this or another option to validate the data in child component?