From eb6dbf0c674d6148ea004971bf97372a2c1bfcc9 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Mon, 9 Dec 2024 16:43:44 +0200 Subject: [PATCH] DataFilter numeric input errors handled --- Radzen.Blazor/RadzenDataFilterItem.razor | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Radzen.Blazor/RadzenDataFilterItem.razor b/Radzen.Blazor/RadzenDataFilterItem.razor index 0021841511b..468160af004 100644 --- a/Radzen.Blazor/RadzenDataFilterItem.razor +++ b/Radzen.Blazor/RadzenDataFilterItem.razor @@ -295,7 +295,21 @@ else builder.AddAttribute(5, "oninput", EventCallback.Factory.Create(this, args => { var v = $"{args.Value}"; - Filter.FilterValue = !string.IsNullOrWhiteSpace(v) ? Convert.ChangeType(v, Nullable.GetUnderlyingType(property.FilterPropertyType) ?? property.FilterPropertyType) : null; + if (!string.IsNullOrWhiteSpace(v)) + { + try + { + Filter.FilterValue = Convert.ChangeType(v, Nullable.GetUnderlyingType(property.FilterPropertyType) ?? property.FilterPropertyType); + } + catch + { + Filter.FilterValue = null; + } + } + else + { + Filter.FilterValue = null; + } })); builder.CloseComponent(); });