Html.Label 显示电子邮件地址 [英] Html.Label to display email address
本文介绍了Html.Label 显示电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Html.Label 在我的 MVC 应用程序中显示一些数据.当我尝试显示电子邮件地址时,它无法正确呈现
I am using Html.Label to display some data in my MVC applilcation. When I am trying to display email address it does not render properly
Model.CopyToEmail = lab@gmail.com
@Html.Label((string)(Model.CopyToEmail))
但我看到的渲染输出是
com
谁能建议如何使用 Html.Label 显示
Could anyone please suggest how to display using Html.Label
lab@gmail.com
推荐答案
Html.Label
需要一个字段来显示 标签.
它将您的字符串作为嵌套属性读取,并打印最内层属性的名称.
Html.Label
takes a field to display a <label>
tag for.
It's reading your string as a nested property, and printing the name of the innermost property.
你只想写普通文本:
@Model.CopyToEmail
您也可以调用@Html.DisplayFor(m => m.CopyToEmail)
.
这篇关于Html.Label 显示电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文