dotnet/aspnetcore

Add support for binding decimal, double, float data type with configurable formatting

已关闭

#5,523 创建于 2018年5月17日

 (33 条评论) (17 个反应) (1 位负责人)C# (10,653 个派生)batch import
Pillar: Technical DebtPriority:2affected-mediumarea-blazorenhancementfeature-blazor-component-modelhelp wantedseverity-major

仓库指标

星标
 (37,933 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

This should work

<input @bind="@price"/>
@code
{
    decimal price;
}

but currently we get an exception: Error: System.ArgumentException: 'bind' does not accept values of type System.Decimal. To read and write this value type, wrap it in a property of type string with suitable getters and setters.

Decimal data type is paramount in every business application. We don't want to use "hacks" and convert it to/from string manually every time.

Support for formatting is also crucial (number of decimal places, decimal and thousandth separators)

贡献者指南