1
我需要在貨幣字段中設置其他人的cultureinfo不同。元數據中的CultureInfo - MVC ASP.NET - C#
元數據:
[Display(ResourceType = typeof(Expressions), Name = "PriceInEuro")]
[DisplayFormat(DataFormatString = "{0:C}", ApplyFormatInEditMode = false)]
[Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "TheFieldXIsRequired")]
public double PriceInEuro { get; set; }
查看:
<div>
@Html.LabelFor(model => model.QuoteEntity.Price)
<span class="display">@Html.DisplayFor(model => model.QuoteEntity.Price, System.Globalization.CultureInfo.CreateSpecificCulture("en-US")) </span>
</div>
我的應用程序有一個CultureInfo的美國(EN-US)作爲默認,但本場應顯示在REAL格式(PT-BR)
不,我需要格式化此模型,因爲此元數據基於實體(edmx)。 – 2012-07-06 18:11:45
@GuilhermeManeskul能否將實體作爲另一個構造函數傳入模型中?這將是一個更好的方法 – 2012-07-06 20:46:29
這是一個補丁,而不是一個解決方案。 – 2015-10-01 18:34:36