用说的优势是什么
@Html.DisplayFor(modelItem => item.Example)
而不是
@item.Example
在带有@foreach(模型中的var项目)的表设置中?
它们看起来非常相似。
可能重复:什么时候应该在MVC中使用Html.Displayfor
概括:
@* Can be used with a DisplayTemplate for extended displaying for the Type. *@
@Html.DisplayFor(modelItem => item.Example)
@* Only displays a HTML encoded (to better protect against XSS attack) string representation of the value. *@
@item.Example
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句