我想將我的視圖模型綁定到Html.Grid。我已將DisplayFormat註釋設置爲我的一個屬性。但是,呈現網格時不應用格式。Html.Grid DisplayFormat數據註釋不起作用
下面的代碼: 在視圖模型:
[DisplayFormat(DataFormatString = "{0,10:###,0}")]
public double AmountCurrency { get; set; }
在ASPX:
<%= Html.Grid<MyViewModel>(Model.MyViewModel)
.Columns(column => {
column.For(x => x.AmountCurrency);
...
當我在ASPX格式化它的工作原理:
column.For(x => x.AmountCurrency).Format("{0,10:###,0}");
不知道爲什麼它不適用於數據註釋。
任何幫助,非常感謝。
謝謝:)
夥計們,任何想法這裏我的錯誤是什麼? – 2010-08-20 06:28:02