asp.net – 从MVC视图中的模型访问displayName属性
发布时间:2020-05-28 00:47:24 所属栏目:asp.Net 来源:互联网
导读:如果我的模型有 [DisplayName(First Name)]public string firstName { get; set; } 然后我可以打印它在View with LabelFor @Html.LabelFor(model = model.acc_first) 然后它将呈现为 label for=firstNameFirst Name/label 但是如何在“
|
如果我的模型有 [DisplayName("First Name")]
public string firstName { get; set; }
然后我可以打印它在View with LabelFor @Html.LabelFor(model => model.acc_first) 然后它将呈现为 <label for="firstName">First Name</label> >但是如何在“原始”中读取View中的属性(FirstName)属性? 解决方法@Html.DisplayNameFor(x => x.acc_first) (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 如何在ASP.NET MVC 3中正确实施“确认密码”?
- asp.net-mvc-3 – 方法“OrderBy”必须在方法“跳过”异常之
- asp.net-mvc – 为什么我的View不包括_Layout.cshtml?
- asp.net中的GridView分页问题
- asp.net – Windows应用程序与Web应用程序开发
- asp.net-mvc – 使用ViewData或不使用ViewData
- ASP.NET Core RC2配置自定义AppSettings
- 在ASP.NET MVC中模拟User.Identity
- asp.net – 我们可以在单个元素上有多个itemprop用于微数据
- asp.net-mvc – 为什么Chrome在ASP.NET MVC中提供文件时搜索
推荐文章
站长推荐
- 如果我的Asp.Net会话有IsNewSession == true,那我
- asp.net – 如何使用JwtSecurityTokenHandler和J
- asp.net-mvc-3 – 在MVC3中使用自定义的IPrincip
- ASP.NET – 如何在User Control中使用Response.R
- 使用Gzip在ASP.NET / IIS7中输出乱码错误页面
- asp.net – 为什么这违反了类型约束?
- asp.net-mvc – 使用jQuery ajax / load提交数组
- asp.net-mvc-3 – 模型binder属性类型int的问题
- asp.net-core – CoreCLR中的哈希算法
- asp.net-mvc – 在ASP.NET MVC 3中的子文件夹中添
热点阅读
