Html.Label显示电子邮件地址 [英] Html.Label to display email address

查看:255
本文介绍了Html.Label显示电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Html.Label显示在我的MVC applilcation一些数据。当我试图显示的电子邮件地址不正确渲染

  Model.CopyToEmail = lab@gmail.com
@ Html.Label((字符串)(Model.CopyToEmail))

但呈现的输出,我看到的是

  COM

任何人都可以请建议如何使用显示Html.Label

  lab@gmail.com


解决方案

Html.Label 需要一个领域来显示<标签> 标签。结果
它是读你的字符串作为嵌套属性,并打印最里面的属性的名称。

您只想写普通文本:

  @ Model.CopyToEmail

您也可以拨打 @ Html.DisplayFor(M = GT; m.CopyToEmail)。

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))

but the rendered output that i see is

com

Could anyone please suggest how to display using Html.Label

lab@gmail.com 

解决方案

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.

You just want to write ordinary text:

@Model.CopyToEmail

You can also call @Html.DisplayFor(m => m.CopyToEmail).

这篇关于Html.Label显示电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆