Make RadzenNumeric empty results in an error

Hi all,

I've got an RadzenDataGrid with a column template with RadzenNumeric or RadzenTextBox component. This works fine at all.
But when I try to make the value empty in the RadzenNumeric component it results in an error, It will never comes in my Change event.


<RadzenNumeric ShowUpDown="false" class="@cssClass" Name="@("ppv-" + @pp.Id)" @bind-Value="@ppValues[pp.Id].FormattedValue" TValue="string" Change="@(args => ChangeNumericValue(args, pp.Format, ppValues[pp.Id]))"></RadzenNumeric>

The error:
Error: System.FormatException: Input string was not in a correct format.*

  • at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)*
  • at System.Convert.ToDecimal(String value, IFormatProvider provider)*
  • at System.String.System.IConvertible.ToDecimal(IFormatProvider provider)*
  • at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)*
  • at System.Convert.ChangeType(Object value, Type conversionType)*
  • at Radzen.ConvertType.ChangeType(Object value, Type type)*
  • at Radzen.Blazor.RadzenNumeric`1.InternalValueChanged(Object value)*
  • at Radzen.Blazor.RadzenNumeric`1.OnChange(ChangeEventArgs args)*
  • at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)*
  • at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)*

Has anyone an idea to fix this?


Iā€™m afraid that editing strings using RadzenNumeric is not supported.

Thanks Enchev,

I will take a look at it, but when I'm entering for example "40" into the RadzenNumeric I have to format it to for example "040.0". That's why I entered TValue="string"

I will change it to a RadzenTextBox.


There is a Format property in RadzenNumeric:

1 Like