I have a Globalize based project set with the Portuguese language "pt-PT", so the decimal number is separate with the comma ",".
I would prefer not to set the comma in the format of the property if possible.
The code I have now (Model):
[DisplayFormat(DataFormatString = "{0:#,##}", ApplyFormatInEditMode = true)]
public decimal SizeOpenedWidth { get; set; }
The View:
@Html.EditorFor(model => model.SizeOpenedWidth, new { htmlAttributes = new { @class = "form-control" } })
The problem is that this solution has the comma "," harcoded in the Model, and it presents for the decimal "11,01", the value "11".
EDIT1:
I was able to find the problem:
{0:#,##} -> {0:#.##}
I replaced the "," with the "." and it's working now, and it's assuming the globalized portuguese format "11,01".
Is it possible to present "11,1" has "11,10" with this type of string format?
EDIT2:
The solution {0:#.##} creates the problem ",1" that presents ",1".