0
I have this html, which I bring from a float:
<input asp-for="Frete" name="Frete" onKeyPress="return(MascaraMoeda(this,'.',',',event))" class="form-control" />
I would like when you bring the data from the bank to appear the value this way 0.00 and not so 0. If the number is filled with 82.50, it appears this way 82.5 and wanted it to appear so 82.50, as I can proceed, I have tried this and it does not work:
ValorTotalPedido = float.Parse(pedidoFornecedor.ValorTotalPedido.ToString("N2")),
would not be an alternative to display the string (that you already format correctly) and the input have a numerical mask?
– rLinhares
@Inhares I have a function that formats, but only at the time the user type, in the event
onKeyPress
– Mariana
an alternative is to call this js function after loading the page (at the end of the ready()); anyway, I always preferred to use
onblur
instead ofonkeypress
on behalf of Ctrl+c Ctrl+v, I don’t know if that would be your case– rLinhares
@In case I bring the data from the same database. Then I need that when called, the fields are formatted.
– Mariana