-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Open
Feature
Copy link
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-component-modelAny feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc)Any feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc)feature-renderingFeatures dealing with how blazor renders componentsFeatures dealing with how blazor renders components
Milestone
Description
Describe the bug
Display Formatting doesn't work with decimal
types in Blazor WebAssembly.
To Reproduce
- Create a New Blazor Web Assembly App.
- Navigate to Index.razor
- Paste the below code.
<EditForm Model="@exampleModel" OnValidSubmit="@HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<InputNumber id="name" @bind-Value="exampleModel.Price" @bind-Value:format="{0:#.##}" />
<button type="submit">Submit</button>
</EditForm>
@code
{
protected ExampleModel exampleModel = new ExampleModel
{
Price = 580.471m
};
protected void HandleValidSubmit()
{
}
public class ExampleModel
{
//[DisplayFormat(DataFormatString = "{0:#.##}", ApplyFormatInEditMode = true)]
public decimal Price { get; set; }
}
}
-
@bind-value:format
doesn't seem to work. I have also tried with[DisplayFormat(DataFormatString = "{0:#.##}", ApplyFormatInEditMode = true)]
Data Annotation. This also doesn't work. -
Later from the docs I noticed that
Data binding works with DateTime format strings using @Bind:format. Other format expressions, such as currency or number formats, aren't available at this time.
Is there any plans on including this in preview release? Please can you share an update on this? Or is there any best workaround for this at the moment?
Further technical details
boukenka, chris-parker-bliss, stevenpua, fingers10, SMarconetto and 3 more
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-component-modelAny feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc)Any feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc)feature-renderingFeatures dealing with how blazor renders componentsFeatures dealing with how blazor renders components