简体   繁体   English

如何在MVC 3中使用LabelFor

[英]How to use LabelFor in MVC 3

@Html.LabelFor(model => model.updateDate)

but this is transformed into <label for="updateDate">updateDate</label> and the value is not displayed just updateDate. 但这会转换为<label for="updateDate">updateDate</label>并且该值不会仅显示在updateDate中。 How can I display the value? 我该如何显示该值?

尝试使用DisplayFor而不是LabelFor

@Html.DisplayFor(model => model.updateDate) 

A small issue with DisplayFor. DisplayFor的一个小问题。
If you load the value from a JS operation, you need to add a span with an id to modify its value . 如果从JS操作加载值,则需要添加带有id的span来修改其值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM