I having problems building my own Component with RadzenTemplateForm
for example i am using a TextInput Component
@using System.Linq.Expressions
@typeparam TValue
<RadzenFormField Visible="@Visible" Text="@Label" AllowFloatingLabel="false">
@if (Rows > 0)
{
<RadzenTextArea Rows="@Rows" @bind-Value="@ParsedValue"
@onblur=OnBlur
Disabled="@Disabled" Placeholder="@Placeholder"
class="@(Resizable ? "resizable" : "non-resizable")"></RadzenTextArea>
}
else
{
<RadzenTextBox @bind-Value="@ParsedValue"
@onblur=OnBlur
Disabled="@Disabled" Placeholder="@Placeholder"></RadzenTextBox>
}
@if (ChildContent != null)
{
@ChildContent
}
</RadzenFormField>
<style>
.resizable {
resize: both;
overflow: auto;
}
.non-resizable {
resize: none;
}
</style>
@code {
[Parameter] public string Label { get; set; } = string.Empty; // Default label
[Parameter] public string Placeholder { get; set; } = string.Empty; // Default label
[Parameter] public bool Disabled { get; set; } = false; // Default is enabled
[Parameter] public bool Visible { get; set; } = true; // Default is visible
[Parameter] public int Rows { get; set; } = 0;
[Parameter] public bool Resizable { get; set; } = false; // New parameter for resizable
[Parameter] public TValue Value { get; set; }
[Parameter] public EventCallback<TValue> ValueChanged { get; set; }
[Parameter] public RenderFragment? ChildContent { get; set; }
[Parameter] public EventCallback OnBlur { get; set; }
private string? ParsedValue
{
get => Value != null ? Convert.ToString(Value) : (string?)null;
set
{
if (value != null)
{
Value = (TValue)ConvertType.ChangeType(value, typeof(TValue));
ValueChanged.InvokeAsync(Value);
}
}
}
}
i am using this component like this for example
<RadzenTemplateForm TItem="Vertret" Data="Vertret" Submit="@OnSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<TextInput Label="Test" @bind-Value=Vertret.OrtZusatz>
<ValidationMessage For=@(() => Vertret.OrtZusatz) />
</TextInput>
<RadzenButton Text="Submit" ButtonType="ButtonType.Submit" />
</RadzenTemplateForm>
my problem is now that when enter a wrong input, my component dosent validate the input correctly

(the TextBox on the left is my component)
for this Property the DataAnnotation is
[Required]
[StringLength(4)]
public string OrtZusatz { get; set; }
How do i use the DataAnnotationsValidator and ValidationMessage correctly
(i already try to remove the typeparam and use the TValue Value directly as a string, didtn work either)