Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove mailto anchor from DisplayFor

I have the following model property:

[DataType(DataType.EmailAddress)]
public string EmailAddress { get; set; }

When I use the displayfor:

@Html.DisplayFor(modelItem => item.EmailAddress)

it adds a 'mailto' anchor to the text. Is there anyway I can specify for it not to include this?

Thanks

like image 238
stats101 Avatar asked May 23 '12 11:05

stats101


People also ask

How do I remove an anchor from a text box?

To edit the anchor, select the anchored text or object, click the Anchor button on the Properties palette, and change its name in the Change Anchor dialog. To delete the anchor, click the Anchor icon and click Remove in the Change Anchor dialog. Why is there an anchor on my text box?

How do I Turn Off the anchor symbol in a file?

If you just don't want to see the anchor symbol (but you do want to keep the object), click File > Options > Display and uncheck the box for "object anchors". Was this reply helpful? Sorry this didn't help.

How do I remove an anchor from an image in illustrator?

Click on the object next to which is the Anchor you want to remove. On the upper right side of the object, you will see the icon for the Layout Options. Click on the “In Line with Text” option. The anchor will disappear, and your image is now inline instead of floating.

How do I add mailto to an anchor tag?

You can add mailto in an anchor tag and open in the same window or new window. Get visitors to send mail immediately by clicking the link contains mailto system. If you have a mail client on your system and mailto is added to the anchor link. The mail client will automatically get opened when you click the link.


Video Answer


1 Answers

You can use one of the followings.

  @Model.EmailAddress 

OR

  @Html.DisplayTextFor(model => model.EmailAddress)
like image 131
Kaf Avatar answered Oct 02 '22 08:10

Kaf