使用MVC 4,我創建了一個模型屬性與「數據信息」的文本框屬性:ASP.NET MVC添加屬性「數據信息」,以Html.TextBoxFor
@Html.TextBoxFor(o => o.TradeOrder.Symbol, new {data-message="Required"})
不過,我得到以下錯誤:
Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.
這裏是一個鏈接更多的信息http://stackoverflow.com/questions/2520487/how-to-use-html-5-data-attributes-in-asp-net-mvc –