我有一个复杂类型的模型,即用户/地址/地址列表
public class User{ public List<Address> Addresses{get;set;} }
在我的视图中我显示了这个
<fieldset><legend>@Html.displayNameFor(model=>model.Addresses)</legend> <table> <tr> <th> @Html.displayNameFor(m => Model.Addresses.Street) </th> <th> @Html.displayNameFor(model => model.Addresses.City) </th> <th> @Html.displayNameFor(model => model.Addresses.State) </th> </tr> @foreach (var item in Model.Addresses) { <tr> <td> @Html.displayFor(m => item.Street) </td> <td> @Html.displayFor(m => item.City) </td> <td> @Html.displayFor(m => item.State) </td> </tr> } </table></fieldset>
displayNameFor Street / City / State不起作用.
在子对象上获取displayNameFor的正确方法是什么?
TIA
Ĵ
解决方法
原文地址:https://www.jb51.cc/aspnet/248951.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。