In an ASP.NET Core 2.0 application, I have a Foo
class with a lot of classical string or numeric members and also a int? Budget
fi
I noticed that InputTagHelper has a Format property, which means one can write :
Finding that though was not easy. It wasn't mentioned in the Input Tag Helper section of the intro. In the end I found it through ASP.NET Core MVC Input Tag Helper Deep Dive
Now I understand why people say ASP.NET Core's documentation is lacking - the intro goes to great lenghts to explain the various tag helpers in a single article, explains their relation to HTML Helpers, but ommits significant properties like Format
. Without direct link to the class's documentation, it takes a bit of digging to find it.
There are quite a few similar questions in SO with answers that say "you can't format" or propose custom solutions.
UPDATE
An issue was opened on July 2017 about POSTing currency values that included a currency symbol. The thread is insteresting as it explains that asp-format
only affects display, so the recommended solution is to put the symbol outside the input
, possibly using Bootstrap input groups :
The recommended solution here is to place the currency indicator outside of the editable field (e.g. before or after)
Perhaps something like this:
€