C#: Number formatting (with dot)

Asked

Viewed 23 times

-1

I’m working on ASP.NET Core MVC and C#.

I needed to present the number, e.g., (double) 1000, as 1,000, when presently the number is presented as 1000 .

The property in the model is as:

        [DisplayFormat(DataFormatString = "{0:#,###}")]
        public double? Kms_Contrato { get; set; }

(looks like the formatting {0:#,###} doesn’t work...)

In the views the property is written as:

        @model MyType

        <td>@Model.Kms_Contrato</td>

and

      @model MyType

      Html.EditorFor(m => m.Kms_Contrato)

How can I do?

1 answer

1

        [DisplayFormat(DataFormatString = "{0:0.000}")]
    public double? Kms_Contrato { get; set; }
  • This solution does not work!!!! (double) 90000is presented as 90000!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.