Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html.Label to display email address

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 = [email protected]
@Html.Label((string)(Model.CopyToEmail))

but the rendered output that i see is

com

Could anyone please suggest how to display using Html.Label

[email protected] 
like image 288
gurrawar Avatar asked Jul 18 '12 18:07

gurrawar


1 Answers

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

like image 163
SLaks Avatar answered Oct 23 '22 07:10

SLaks