Razor MVC numeric format for textbox

I have a textbox, in that i insert a number, the code are the following,

     @Html.TextBox("Semana1", "", new { @type = "number", @placeholder = "Ingrese Proyección", @maxlength = "15"   })

this textbox display a number 12356

I need that the textbox display a number with the format 123.456

thanks for your help.

Upvotes: 1

Views: 4008

Answers (2)

Karthik Elumalai
Karthik Elumalai

Reputation: 1612

@Html.TextBoxFor(m => m.TotalAmount, "{0:0.00}")

Useful link:https://stackoverflow.com/a/24669691/3397630

Upvotes: 2

Sameer
Sameer

Reputation: 383

You can use a step with your input. Add the below as an example.

@type = "number", @step = "0.01", @size = "6",

Upvotes: 1

Related Questions